예제 #1
0
파일: update.php 프로젝트: xi67/MAB-LAB
define('DIRECT_ACCESS_CHECK', true);
define('BASE_PATH', '../../');
require_once '../updatehelper.php';
require_once BASE_PATH . 'includes/reporthelper.class.php';
$mUpdateHelper = new UpdateHelper();
$mUpdateHelper->begin();
$mUpdateHelper->applySQLUpdateFile();
$mUpdateHelper->exitOnError();
$mUpdateHelper->printStartNextStepMsg("Start updating issues table");
$succeeded = true;
$packages = DbHelper::selectRows(TBL_REPORTS, null, REPORT_PACKAGE_NAME, REPORT_ISSUE . ', ' . REPORT_PACKAGE_NAME, REPORT_ISSUE, null, false);
foreach ($packages as $package) {
    $issueId = $package[0];
    $packageName = $package[1];
    // skip empty package name
    if (strlen($packageName) == 0) {
        $mUpdateHelper->printStepMsg("Found empty package name !", true, false);
        continue;
    }
    $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
    if ($appId == -1) {
        $succeeded = false;
    }
    $mUpdateHelper->printStepMsg("Inserted application " . $packageName . ", id is " . $appId, $appId == -1, false);
    $mUpdateHelper->printStepMsg('Update issued #' . $issueId . ' with application id #' . $appId, false, false);
    DbHelper::exec('UPDATE ' . TBL_ISSUES . ' SET ' . ISSUE_APP_ID . '=' . $appId . ' WHERE ' . ISSUE_ID . '=' . $issueId, false);
}
$mUpdateHelper->printEndStepMsg($succeeded, null, false);
$mUpdateHelper->printEndStepMsg(true, null, true);
$mUpdateHelper->end();
예제 #2
0
파일: controller.php 프로젝트: xi67/MAB-LAB
 $message = 'OK';
 $chartId = $_GET['chartId'];
 switch ($chartId) {
     case REPORTS_PER_ANDROID_VERSION_PIE_CHART_ID:
         $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_ANDROID_VERSION . ', COUNT(*)', REPORT_ANDROID_VERSION, null, false);
         if ($arr != null) {
             $data = ChartHelper::convertMySQLArrToPieChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
         break;
     case REPORTS_PER_APPLICATION_PIE_CHART_ID:
         $arr = DBHelper::selectRows(TBL_REPORTS, null, null, REPORT_PACKAGE_NAME . ',COUNT(*)', REPORT_PACKAGE_NAME, null, false);
         if ($arr != null) {
             for ($i = 0; $i < sizeof($arr); ++$i) {
                 $arr[$i][0] = ReportHelper::formatPackageName($arr[$i][0], true);
             }
             $data = ChartHelper::convertMySQLArrToPieChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
         break;
     case REPORTS_EVOLUTION_LINE_CHART_ID:
         $projection = 'DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY) date, ' . 'DATE_FORMAT(DATE(NOW()-INTERVAL ' . INC_VALUE . ' DAY),"%m-%d") formatted_date, ' . '(SELECT COUNT(*) FROM ' . TBL_REPORTS . ' WHERE DATE(user_crash_date)=date) reports,' . '(SELECT COUNT(*) FROM ' . TBL_ISSUES . ' WHERE DATE(issue_datetime)=date) issues, ' . '(SELECT count(*)/DAYOFYEAR(DATE_FORMAT(' . REPORT_CRASH_DATE . ', "%Y-%m-%d")) FROM ' . TBL_REPORTS . ' WHERE DATE_FORMAT(' . REPORT_CRASH_DATE . ',"%Y")=\'' . date('Y') . '\') avg_per_day_current_year';
         $orderby = 'inc ASC LIMIT 15';
         $arr = DBHelper::selectRows(TBL_INCREMENTS, null, $orderby, $projection, null, null, true);
         if ($arr != null && count($arr) > 0) {
             $data = ChartHelper::convertMySQLArrToReportsEvolChartJSON($arr);
         } else {
             $message = 'No data yet recorded.|';
         }
예제 #3
0
 public function getApplicationDesc()
 {
     return ReportHelper::formatPackageName($this->package_name, true) . " " . $this->getApplicationVersion();
 }
예제 #4
0
 public static function insertSale($values)
 {
     $error = null;
     $packageName = $values[SALE_PRODUCT_ID];
     $appId = DbHelper::fetchOrInsertApplication($packageName, ReportHelper::formatPackageName($packageName, true));
     Debug::logd('Application id #' . $appId, 'INSERT SALE');
     if ($appId > 0) {
         $values[SALE_APP_ID] = $appId;
         $error = self::exec('REPLACE INTO ' . TBL_SALES . ' ' . self::convertArrToInsertValues($values));
         if ($error != null) {
             if (self::countRows(TBL_SALES, SALE_ORDER_NUMBER . '=' . $values[SALE_ORDER_NUMBER]) == 0) {
                 $error = 'Row insertion check failed !';
             }
         }
     } else {
         $error = 'Retreive or insert application failed !';
     }
     return $error;
 }