Changeset 1515401
- Timestamp:
- 10/15/2016 02:23:57 PM (9 years ago)
- Location:
- eve-shipinfo/trunk
- Files:
-
- 5 edited
-
classes/EVEShipInfo.php (modified) (7 diffs)
-
classes/EVEShipInfo/Admin/Page/Main/Dashboard.php (modified) (3 diffs)
-
data/data.zip (modified) (previous)
-
js/admin/Dashboard.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eve-shipinfo/trunk/classes/EVEShipInfo.php
r1512895 r1515401 124 124 $data = wp_remote_retrieve_response_message($result); 125 125 } else { 126 $infoRemote = EVEShipInfo::parseVersion(trim($result['body'])); 127 $infoLocal = EVEShipInfo::parseVersion($this->getDataVersion()); 128 $update = false; 129 if($infoRemote['date'] > $infoLocal['date']) { 130 $update = true; 131 } 132 126 133 $data = array( 127 ' online' => $result['body'],128 ' installed' => $this->getDataVersion()134 'remoteVersion' => $infoRemote['version'], 135 'updateAvailable' => $update, 129 136 ); 130 137 } … … 132 139 133 140 $response = array( 141 'url' => $url, 134 142 'state' => $state, 135 143 'data' => $data … … 1205 1213 * @return boolean 1206 1214 */ 1207 public function isDatabaseUpToDate( )1208 { 1209 if(isset($this->cachedDBUpToDate) ) {1215 public function isDatabaseUpToDate($force=false) 1216 { 1217 if(isset($this->cachedDBUpToDate) && !$force) { 1210 1218 return $this->cachedDBUpToDate; 1211 1219 } … … 1262 1270 $this->handle_unpackDataFiles(); 1263 1271 1264 if($this->isDatabaseUpToDate( )) {1272 if($this->isDatabaseUpToDate(true)) { 1265 1273 return; 1266 1274 } … … 1286 1294 $this->handle_databasePopulate(); 1287 1295 1288 $this->setOption('installed_db_version', $this->getDataVersion());1289 1296 $this->cachedDBUpToDate = true; 1290 1297 } … … 1466 1473 } 1467 1474 } 1475 1476 $version = $this->loadDataFile('db-version.txt'); 1477 $this->setOption('installed_db_version', $version); 1468 1478 } 1469 1479 … … 1482 1492 return null; 1483 1493 } 1494 1495 public static function parseVersion($version) 1496 { 1497 $dateString = substr($version, strpos($version, '-')+1); 1498 $year = substr($dateString, 0, 4); 1499 $month = substr($dateString, 4, 2); 1500 $day = substr($dateString, 6, 2); 1501 1502 return array( 1503 'version' => $version, 1504 'year' => $year, 1505 'month' => $month, 1506 'day' => $day, 1507 'date' => new DateTime($year.'-'.$month.'-'.$day) 1508 ); 1509 } 1484 1510 } 1485 1511 -
eve-shipinfo/trunk/classes/EVEShipInfo/Admin/Page/Main/Dashboard.php
r1512895 r1515401 146 146 } 147 147 148 $ content= file_get_contents($versionFile);149 if(empty($ content)) {148 $version = file_get_contents($versionFile); 149 if(empty($version)) { 150 150 throw new EVEShipInfo_Exception( 151 151 'No version information available', … … 154 154 ); 155 155 } 156 157 if($content == $this->plugin->getDataVersion()) { 156 157 $infoNew = EVEShipInfo::parseVersion($version); 158 $infoOld = EVEShipInfo::parseVersion($this->plugin->getDataVersion()); 159 160 if($infoNew['date'] <= $infoOld['date']) { 158 161 return $this->ui->createStuffBox(__('Update the database', 'eve-shipinfo')) 159 162 ->makeWarning() 160 163 ->setContent( 161 164 '<p>'. 162 sprintf( 163 __('The database version %1$s is already installed.', 'eve-shipinfo'), 164 '<code>' . $content . '</code>' 165 ). 165 __('A newer or equal database is already installed.', 'eve-shipinfo'). 166 166 '</p>'. 167 167 '<p>'. 168 $this->ui->button(__(' Back', 'eve-shipinfo'))168 $this->ui->button(__('OK', 'eve-shipinfo')) 169 169 ->link($this->getURL()). 170 170 '</p>' … … 255 255 '</p>'. 256 256 '<p id="updatecheck-available" style="display:none" class="text-warning">'. 257 __('An update is available.', 'eve-shipinfo').' '. 257 sprintf( 258 __('An update is available: version %1$s', 'eve-shipinfo'), 259 '<code id="updatecheck-remoteversion"></code>' 260 ).' '. 258 261 sprintf( 259 262 __('Get it from the %1$splugin project page%2$s.', 'eve-shipinfo'), -
eve-shipinfo/trunk/js/admin/Dashboard.js
r1417468 r1515401 31 31 } 32 32 33 if(data.data.online != data.data.installed) { 33 var result = data.data; 34 35 if(result.updateAvailable == true) { 36 jQuery('#updatecheck-remoteversion').html(result.remoteVersion); 34 37 jQuery('#updatecheck-available').show(); 35 38 return; -
eve-shipinfo/trunk/readme.txt
r1417469 r1515401 16 16 = Features = 17 17 18 * Portable EVE Online ships database with all 4 63ships19 * 9 26 high quality custom ship screenshots (front/side)20 * Integrated simplethemes for light and dark layouts18 * Portable EVE Online ships database with all 474 ships 19 * 948 high quality custom ship screenshots (front/side), separate download 20 * Integrated themes for light and dark layouts 21 21 * Link ship names to info popups or virtual ship pages within your blog 22 22 * Extremely customizable ship lists shortcode
Note: See TracChangeset
for help on using the changeset viewer.