Plugin Directory

Changeset 1515401


Ignore:
Timestamp:
10/15/2016 02:23:57 PM (9 years ago)
Author:
AeonOfTime
Message:
  • Fixed updating the installed DB version
  • Updated the data file to the last version
  • Fixed the online update check
  • Prepared the release
Location:
eve-shipinfo/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • eve-shipinfo/trunk/classes/EVEShipInfo.php

    r1512895 r1515401  
    124124                $data = wp_remote_retrieve_response_message($result);
    125125            } 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               
    126133                $data = array(
    127                     'online' => $result['body'],
    128                     'installed' => $this->getDataVersion()
     134                    'remoteVersion' => $infoRemote['version'],
     135                    'updateAvailable' => $update,
    129136                );
    130137            }
     
    132139
    133140        $response = array(
     141            'url' => $url,
    134142            'state' => $state,
    135143            'data' => $data
     
    12051213    * @return boolean
    12061214    */
    1207     public function isDatabaseUpToDate()
    1208     {
    1209         if(isset($this->cachedDBUpToDate)) {
     1215    public function isDatabaseUpToDate($force=false)
     1216    {
     1217        if(isset($this->cachedDBUpToDate) && !$force) {
    12101218            return $this->cachedDBUpToDate;
    12111219        }
     
    12621270        $this->handle_unpackDataFiles();
    12631271       
    1264         if($this->isDatabaseUpToDate()) {
     1272        if($this->isDatabaseUpToDate(true)) {
    12651273            return;
    12661274        }
     
    12861294        $this->handle_databasePopulate();
    12871295
    1288         $this->setOption('installed_db_version', $this->getDataVersion());
    12891296        $this->cachedDBUpToDate = true;
    12901297    }
     
    14661473            }
    14671474        }
     1475       
     1476        $version = $this->loadDataFile('db-version.txt');
     1477        $this->setOption('installed_db_version', $version);
    14681478    }
    14691479   
     
    14821492        return null;
    14831493    }
     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    }
    14841510}
    14851511   
  • eve-shipinfo/trunk/classes/EVEShipInfo/Admin/Page/Main/Dashboard.php

    r1512895 r1515401  
    146146        }
    147147       
    148         $content = file_get_contents($versionFile);
    149         if(empty($content)) {
     148        $version = file_get_contents($versionFile);
     149        if(empty($version)) {
    150150            throw new EVEShipInfo_Exception(
    151151                'No version information available',
     
    154154            );
    155155        }
    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']) {
    158161            return $this->ui->createStuffBox(__('Update the database', 'eve-shipinfo'))
    159162            ->makeWarning()
    160163            ->setContent(
    161164                '<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').
    166166                '</p>'.
    167167                '<p>'.
    168                     $this->ui->button(__('Back', 'eve-shipinfo'))
     168                    $this->ui->button(__('OK', 'eve-shipinfo'))
    169169                    ->link($this->getURL()).
    170170                '</p>'
     
    255255            '</p>'.
    256256            '<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                ).' '.
    258261                sprintf(
    259262                    __('Get it from the %1$splugin project page%2$s.', 'eve-shipinfo'),
  • eve-shipinfo/trunk/js/admin/Dashboard.js

    r1417468 r1515401  
    3131        }
    3232       
    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);
    3437            jQuery('#updatecheck-available').show();
    3538            return;
  • eve-shipinfo/trunk/readme.txt

    r1417469 r1515401  
    1616= Features =
    1717
    18 *   Portable EVE Online ships database with all 463 ships
    19 *   926 high quality custom ship screenshots (front/side)
    20 *   Integrated simple themes for light and dark layouts
     18*   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
    2121*   Link ship names to info popups or virtual ship pages within your blog
    2222*   Extremely customizable ship lists shortcode
Note: See TracChangeset for help on using the changeset viewer.