本文整理匯總了PHP中UpgradeHistory::retrieve方法的典型用法代碼示例。如果您正苦於以下問題:PHP UpgradeHistory::retrieve方法的具體用法?PHP UpgradeHistory::retrieve怎麽用?PHP UpgradeHistory::retrieve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UpgradeHistory
的用法示例。
在下文中一共展示了UpgradeHistory::retrieve方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkForExisting
/**
* Given a name check if it exists in the table
* @param name the unique key from the manifest
* @param id the id of the item you are comparing to
* @return upgrade_history object if found, null otherwise
*/
function checkForExisting($patch_to_check)
{
$uh = new UpgradeHistory();
if ($patch_to_check != null) {
if (empty($patch_to_check->id_name)) {
$where = " WHERE name = '{$patch_to_check->name}' ";
} else {
$where = " WHERE id_name = '{$patch_to_check->id_name}' ";
}
if (!empty($patch_to_check->id)) {
$where .= " AND id != '{$patch_to_check->id}' ";
} else {
$where .= " AND id is not null ";
}
$query = "SELECT id FROM " . $this->table_name . " " . $where;
$result = $uh->db->query($query);
if (empty($result)) {
return null;
}
$row = $uh->db->fetchByAssoc($result);
if (empty($row)) {
return null;
}
if (!empty($row['id'])) {
return $uh->retrieve($row['id']);
}
}
return null;
}
示例2: UpgradeHistory
break;
default:
break;
}
switch ($mode) {
case "Install":
$file_action = "copied";
// if error was encountered, script should have died before now
$new_upgrade = new UpgradeHistory();
//determine if this module has already been installed given the unique_key to
//identify the module
// $new_upgrade->checkForExisting($unique_key);
if (!empty($previous_id)) {
$new_upgrade->id = $previous_id;
$uh = new UpgradeHistory();
$uh->retrieve($previous_id);
unlink($uh->filename);
}
$new_upgrade->filename = $install_file;
$new_upgrade->md5sum = md5_file($install_file);
$new_upgrade->type = $install_type;
$new_upgrade->version = $version;
$new_upgrade->status = "installed";
$new_upgrade->name = $name;
$new_upgrade->description = $description;
$new_upgrade->id_name = $id_name;
$new_upgrade->manifest = $s_manifest;
$new_upgrade->save();
break;
case "Uninstall":
$file_action = "removed";