예제 #1
0
 /**
  * Returns an array of packages that have newer versions in the local packages directory
  * than those which are in the Packages table. This means they're ready to be upgraded
  */
 public static function getLocalUpgradeablePackages()
 {
     $packages = Package::getAvailablePackages(false);
     $upgradeables = array();
     $db = Loader::db();
     foreach ($packages as $p) {
         $row = $db->GetRow("select pkgID, pkgVersion from Packages where pkgHandle = ? and pkgIsInstalled = 1", array($p->getPackageHandle()));
         if ($row['pkgID'] > 0) {
             if (version_compare($p->getPackageVersion(), $row['pkgVersion'], '>')) {
                 $p->pkgCurrentVersion = $row['pkgVersion'];
                 $upgradeables[] = $p;
             }
         }
     }
     return $upgradeables;
 }
예제 #2
0
 /**
  * Returns an array of packages that have newer versions in the local packages directory
  * than those which are in the Packages table. This means they're ready to be upgraded
  * @return Package[]
  */
 public static function getLocalUpgradeablePackages()
 {
     $packages = Package::getAvailablePackages(false);
     $upgradeables = array();
     $db = Database::getActiveConnection();
     foreach ($packages as $p) {
         $row = $db->GetRow("SELECT pkgID, pkgVersion FROM Packages WHERE pkgHandle = ? AND pkgIsInstalled = 1", array($p->getPackageHandle()));
         if ($row['pkgID'] > 0) {
             if (version_compare($p->getPackageVersion(), $row['pkgVersion'], '>')) {
                 $p->pkgCurrentVersion = $row['pkgVersion'];
                 $upgradeables[] = $p;
             }
         }
     }
     return $upgradeables;
 }