Esempio n. 1
0
 /**
  * load a package
  * 
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if (@BitBase::verifyId($this->mPackagerId)) {
         $selectSql = $joinSql = $orderSql = $whereSql = "";
         $bindVars = $ret = array();
         $whereSql = "WHERE pkgv.`packager_id`=?";
         $bindVars[] = $this->mPackagerId;
         $query = "\n\t\t\t\tSELECT pkgv.*, pkgp.*, pkgi.`download_date`, pkgi.`install_date`\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "packager_versions` pkgv\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "packager_packages` pkgp ON( pkgv.`package`=pkgp.`package` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "packager_installed` pkgi ON( pkgv.`packager_id`=pkgi.`packager_id` )\n\t\t\t\t{$whereSql}";
         if ($aux = $this->mDb->getRow($query, $bindVars)) {
             $this->mInfo = $aux;
             $this->mInfo['filename'] = $this->getPackageFilename($this->mInfo);
             $this->mInfo['mime_type'] = 'application/zip';
             $this->mInfo['last_modified'] = $this->mInfo['release_date'];
             $this->mInfo['source_file'] = $this->getPackageFilepath($this->mInfo);
             $this->mInfo['package_display_url'] = Packager::getDisplayUrlFromHash($aux);
             $this->mInfo['display_url'] = $this->getDisplayUrlFromHash($aux);
             $this->mInfo['package_url'] = $this->getPackageUrl($aux);
             $this->mInfo['changelog'] = $this->getChangelog();
             $this->mInfo['dependencies'] = $this->getDependencies();
         }
     }
     return count($this->mInfo);
 }