Changeset 196386 in webkit
- Timestamp:
- Feb 10, 2016 1:05:37 PM (8 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r196333 r196386 1 2016-02-10 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add the support for maintenance mode 4 https://bugs.webkit.org/show_bug.cgi?id=154072 5 6 Reviewed by Chris Dumez. 7 8 Added the crude support for maintenance mode whereby which the reports are stored in the filesystem 9 instead of the database. 10 11 * config.json: Added maintenanceMode and maintenanceDirectory as well as forgotten siteTitle and 12 remoteServer.httpdMutexDir. 13 * public/api/report.php: 14 (main): Don't connect to the database or modify database when maintenanceMode is set. 15 * public/include/json-header.php: 16 (ensure_privileged_api_data): Exit with InMaintenanceMode when maintenanceMode is set. This prevents 17 privileged API such as creating analysis tasks and new A/B testing groups from modifying the database. 18 1 19 2016-02-09 Ryosuke Niwa <rniwa@webkit.org> 2 20 -
trunk/Websites/perf.webkit.org/config.json
r196195 r196386 1 1 { 2 "siteTitle": "WebKit Performance Dashboard", 2 3 "debug": true, 3 4 "jsonCacheMaxAge": 600, … … 10 11 "name": "webkit-perf-db" 11 12 }, 13 "maintenanceMode": false, 14 "maintenanceDirectory": "reported/", 12 15 "testServer": { 13 16 "hostname": "localhost", … … 21 24 "httpdPID": "tools/remote-server-relay.pid", 22 25 "httpdErrorLog": "tools/remote-server-relay.log", 23 "url": "http://perf.webkit.org", 26 "httpdMutexDir": "/tmp/org.webkit.perf.remote/", 27 "url": "https://perf-safari.apple.com", 24 28 "basicAuth": { 25 29 "username": "username", -
trunk/Websites/perf.webkit.org/public/api/report.php
r163688 r196386 8 8 set_exit_detail('failureStored', false); 9 9 10 $maintenance_mode = config('maintenanceMode'); 11 if ($maintenance_mode && !config('maintenanceDirectory')) 12 exit_with_error('MaintenanceDirectoryNotSet'); 13 10 14 $db = new Database; 11 if (!$ db->connect())15 if (!$maintenance_mode && !$db->connect()) 12 16 exit_with_error('DatabaseConnectionFailure'); 13 17 … … 20 24 set_exit_detail('processedRuns', 0); 21 25 foreach ($parsed_json as $i => $report) { 22 $processor = new ReportProcessor($db); 23 $processor->process($report); 26 if (!$maintenance_mode) { 27 $processor = new ReportProcessor($db); 28 $processor->process($report); 29 } 24 30 set_exit_detail('processedRuns', $i + 1); 25 31 } 26 32 27 $generator = new ManifestGenerator($db); 28 if (!$generator->generate()) 29 exit_with_error('FailedToGenerateManifest'); 30 else if (!$generator->store()) 31 exit_with_error('FailedToStoreManifest'); 33 if ($maintenance_mode) { 34 $files = scandir(config_path('maintenanceDirectory', '')); 35 $i = 0; 36 $filename = ''; 37 do { 38 $i++; 39 $filename = "$i.json"; 40 } while (in_array($filename, $files)); 41 file_put_contents(config_path('maintenanceDirectory', $filename), $post_data, LOCK_EX); 42 } else { 43 $generator = new ManifestGenerator($db); 44 if (!$generator->generate()) 45 exit_with_error('FailedToGenerateManifest'); 46 else if (!$generator->store()) 47 exit_with_error('FailedToStoreManifest'); 48 } 32 49 33 50 exit_with_success(); -
trunk/Websites/perf.webkit.org/public/include/json-header.php
r194130 r196386 92 92 function ensure_privileged_api_data() { 93 93 global $HTTP_RAW_POST_DATA; 94 95 if (config('maintenanceMode')) 96 exit_with_error('InMaintenanceMode'); 94 97 95 98 if ($_SERVER['REQUEST_METHOD'] != 'POST')
Note: See TracChangeset
for help on using the changeset viewer.