/**
  * Gets a list of available updates.
  */
 protected function readUpdates()
 {
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $this->updates = PackageUpdate::getAvailableUpdates();
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->os = PHP_OS;
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $this->webserver = $_SERVER['SERVER_SOFTWARE'];
     }
     $this->sqlVersion = WCF::getDB()->getVersion();
     $this->sqlType = WCF::getDB()->getDBType();
     $this->readLoad();
     $this->readStat();
     // updates
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $this->updates = PackageUpdate::getAvailableUpdates();
     }
     // news
     if (false) {
         $this->news = FeedReaderSource::getEntries(5);
         foreach ($this->news as $key => $news) {
             $this->news[$key]['description'] = preg_replace('/href="(.*?)"/e', '\'href="' . RELATIVE_WCF_DIR . 'acp/dereferrer.php?url=\'.rawurlencode(\'$1\').\'" class="externalURL"\'', $news['description']);
         }
     } else {
         $this->news = array();
     }
 }
 /**
  * @see	Page::assignVariables()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (!count($_POST)) {
         // refresh package database
         PackageUpdate::refreshPackageDatabase();
     }
     // get updatable packages
     $this->availableUpdates = PackageUpdate::getAvailableUpdates();
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->os = PHP_OS;
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $this->webserver = $_SERVER['SERVER_SOFTWARE'];
     }
     $this->sqlVersion = WCF::getDB()->getVersion();
     $this->sqlType = WCF::getDB()->getDBType();
     $this->readLoad();
     $this->readStat();
     // updates
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $updates = PackageUpdate::getAvailableUpdates();
         //print_r($updates);exit;
         foreach ($updates as $update) {
             $versions = array_reverse($update['versions']);
             // find newest minor update
             $i = 0;
             $currentVersionStatus = preg_match('/(alpha|beta|RC)/i', $update['packageVersion']) ? 'unstable' : 'stable';
             foreach ($versions as $version) {
                 $newVersionStatus = preg_match('/(alpha|beta|RC)/i', $version['packageVersion']) ? 'unstable' : 'stable';
                 if ($currentVersionStatus == $newVersionStatus && preg_match('/^(\\d\\.\\d)/', $update['packageVersion'], $match1) && preg_match('/^(\\d\\.\\d)/', $version['packageVersion'], $match2)) {
                     if ($match1[1] == $match2[1]) {
                         $minorUpdate = $update;
                         $minorUpdate['version'] = $version;
                         $this->minorUpdates[] = $minorUpdate;
                         if ($i != 0) {
                             $this->majorUpdates[] = $update;
                         }
                         continue 2;
                     }
                 }
                 $i++;
             }
             $this->majorUpdates[] = $update;
         }
     }
     // news
     $this->news = FeedReaderSource::getEntries(5);
     foreach ($this->news as $key => $news) {
         $this->news[$key]['description'] = preg_replace_callback('/href="(.*?)"/', array('IndexPage', 'parseNewsFeedCallback'), $news['description']);
     }
 }
 /**
  * Gets a list of available updates.
  */
 protected function readUpdates()
 {
     if (WCF::getUser()->getPermission('admin.system.package.canUpdatePackage')) {
         require_once WCF_DIR . 'lib/acp/package/update/PackageUpdate.class.php';
         $this->updates = PackageUpdate::getAvailableUpdates();
         // kick wbb 3.0 updates
         if (CMS_DISABLE_WBB_UPDATES) {
             foreach ($this->updates as $packageID => $package) {
                 if ($package['package'] == 'com.woltlab.wbb') {
                     foreach ($package['versions'] as $version => $packageVersion) {
                         if (Package::compareVersion($version, '3.0.0 Beta 1', '>=')) {
                             unset($this->updates[$packageID]['versions'][$version]);
                         }
                     }
                     if (!count($this->updates[$packageID]['versions'])) {
                         $this->updates = PackageUpdate::getAvailableUpdates(false);
                         unset($this->updates[$packageID]);
                     } else {
                         $this->updates[$packageID]['version'] = end($this->updates[$packageID]['versions']);
                     }
                 }
             }
         }
     }
 }