本文整理汇总了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";