define('DIRECT_ACCESS_CHECK', true); define('BASE_PATH', '../../'); define('_REPORT_ID', 0); define('_APP_VERSION_CODE', 1); define('_APP_VERSION_NAME', 2); define('_PACKAGE_NAME', 3); define('_STACK_TRACE', 4); define('_REPORT_STATE', 5); define('_CRASH_DATE', 6); require_once '../updatehelper.php'; $mUpdateHelper = new UpdateHelper(); $mUpdateHelper->begin(); $mUpdateHelper->applySQLUpdateFile(); $mUpdateHelper->exitOnError(); $mUpdateHelper->printStartNextStepMsg('Populate increments table'); // populate table increments for ($i = 0; $i <= 180; ++$i) { $mUpdateHelper->execSQL('INSERT INTO ' . DBHelper::getTblName(TBL_INCREMENTS) . '(' . INC_VALUE . ') VALUES (' . $i . ');'); } // recreate issue keys with new algorithm $mUpdateHelper->printStartNextStepMsg('Get reports'); $reports = DBHelper::selectRows(TBL_REPORTS, null, null, 'report_id, app_version_code, app_version_name, package_name, stack_trace, report_state, user_crash_date', null, null, false); $mUpdateHelper->printStartNextStepMsg('Walk through reports array to create issues'); $issues = array(); try { foreach ($reports as $report) { $arr = explode("\n", $report[_STACK_TRACE]); $cause = $arr[0]; // create a key to identify the issue from all reports $k = DBHelper::getReportIssueKey($report);
<?php 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);
<?php define('DIRECT_ACCESS_CHECK', true); define('BASE_PATH', '../'); require_once 'updatehelper.php'; $mUpdateHelper = new UpdateHelper(); $mUpdateHelper->begin(); $mUpdateHelper->applySQLUpdateFile('db-install.sql'); $mUpdateHelper->exitOnError(); $mUpdateHelper->printStartNextStepMsg('Populate increments table'); // populate table increments for ($i = 0; $i <= 180; ++$i) { $mUpdateHelper->execSQL('INSERT INTO ' . TBL_INCREMENTS . '(' . INC_VALUE . ') VALUES (' . $i . ');'); } $mUpdateHelper->printEndStepMsg(true, null, true); $mUpdateHelper->end();