本文整理汇总了PHP中hashToFile函数的典型用法代码示例。如果您正苦于以下问题:PHP hashToFile函数的具体用法?PHP hashToFile怎么用?PHP hashToFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hashToFile函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$packages = $pm->getinstalledPackages(array('module'));
foreach ($packages as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$uh = new UpgradeHistory();
$uh->name = $pack['name'];
$history = $uh->checkForExisting($uh);
$this->filesToRemove[] = "custom/Extension/application/Ext/Include/{$history->id_name}.php";
$history->delete();
$this->fileToDelete($this->filesToRemove);
$this->log("Useless files of {$pack['name']} v{$pack['version']} removed");
}
}
foreach ($pm->getPackagesInStaging() as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$file = UploadStream::getFSPath(hashToFile($pack['file']));
$this->fileToDelete($file);
foreach (array('manifest', 'icon') as $meta) {
$this->fileToDelete(pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . "-{$meta}.php");
}
}
}
}
示例2: remove
function remove()
{
$json = getJSONobj();
$file = '';
if (isset($_REQUEST['file'])) {
$file = urldecode(hashToFile($_REQUEST['file']));
}
$GLOBALS['log']->debug("FILE TO REMOVE: " . $file);
if (!empty($file)) {
unlink($file);
foreach (array("manifest", "icon") as $meta) {
$this->rmMetaFile($file, $meta);
}
}
echo 'result = ' . $json->encode(array('result' => 'true'));
}
示例3: disable_copy
function disable_copy()
{
//when we disable we want to copy the -restore files back into the file system
//but we should check the version in the module install against the version on the file system
//if they match then we can copy the file back, but otherwise we should ask the user.
// $GLOBALS['log']->debug('ModuleInstaller.php->disable_copy()');
if (isset($GLOBALS['mi_overwrite_files']) && $GLOBALS['mi_overwrite_files']) {
// $GLOBALS['log']->debug('ModuleInstaller.php->disable_copy():mi_overwrite_files=true');
if (!empty($this->installdefs['copy'])) {
// $GLOBALS['log']->debug('ModuleInstaller.php->disable_copy(): installdefs not empty');
foreach ($this->installdefs['copy'] as $cp) {
$cp['to'] = clean_path(str_replace('<basepath>', $this->base_dir, $cp['to']));
$backup_path = clean_path(remove_file_extension(urldecode(hashToFile($_REQUEST['install_file']))) . "-restore/" . $cp['to']);
// bug 16966 tyoung - replaced missing assignment to $backup_path
//check if this file exists in the -restore directory
// $GLOBALS['log']->debug("ModuleInstaller.php->disable_copy(): backup_path=".$backup_path);
if (file_exists($backup_path)) {
//since the file exists, then we want do an md5 of the install version and the file system version
$from = str_replace('<basepath>', $this->base_dir, $cp['from']);
//if(is_file($from) && md5_file($from) == md5_file($cp['to'])){
//since the files are the same then we can safely move back from the -restore
//directory into the file system
$GLOBALS['log']->debug("DISABLE COPY:: FROM: " . $backup_path . " TO: " . $cp['to']);
$this->copy_path($backup_path, $cp['to']);
/*}else{
//since they are not equal then we need to prompt the user
}*/
}
//fi
}
//rof
}
//fi
}
//fi
}
示例4: unset
require_once 'modules/Administration/UpgradeWizardCommon.php';
require_once 'include/SugarSmarty/plugins/function.sugar_csrf_form_token.php';
unset($_SESSION['rebuild_relationships']);
unset($_SESSION['rebuild_extensions']);
// process commands
if (empty($_REQUEST['install_file'])) {
die($mod_strings['LBL_UPGRADE_WIZARD_FILE_NOT_SPEC']);
}
if (!isset($_REQUEST['mode']) || $_REQUEST['mode'] == "") {
die($mod_strings['LBL_UPGRADE_WIZARD_NO_MODE_SPEC']);
}
if (!file_exists($base_tmp_upgrade_dir)) {
mkdir($base_tmp_upgrade_dir, 0755, true);
}
$unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
$install_file = hashToFile($_REQUEST['install_file']);
$hidden_fields = "";
$new_lang_name = "";
$new_lang_desc = "";
$mode = $_REQUEST['mode'];
$hidden_fields .= "<input type=hidden name=\"mode\" value=\"{$mode}\"/>";
$hidden_fields .= smarty_function_sugar_csrf_form_token(array(), $smarty);
$install_type = UpgradeWizardCommon::getInstallType($install_file);
$version = "";
$previous_version = "";
$show_files = true;
$zip_from_dir = ".";
$zip_to_dir = ".";
$zip_force_copy = array();
$license_file = $unzip_dir . '/LICENSE';
$readme_file = $unzip_dir . '/README.txt';
示例5: copy
copy($manifest_file, $target_manifest);
$GLOBALS['ML_STATUS_MESSAGE'] = $base_filename . $mod_strings['LBL_UW_UPLOAD_SUCCESS'];
} else {
$GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
}
} else {
unlinkTempFiles();
die($mod_strings['ERR_UW_NO_MANIFEST']);
}
}
} else {
if ($run == $mod_strings['LBL_UW_BTN_DELETE_PACKAGE']) {
if (!empty($_REQUEST['install_file'])) {
die($mod_strings['ERR_UW_NO_UPLOAD_FILE']);
}
$delete_me = hashToFile($delete_me);
$checkFile = strtolower($delete_me);
if (substr($delete_me, -4) != ".zip" || substr($delete_me, 0, 9) != "upload://" || strpos($checkFile, "..") !== false || !file_exists($checkFile)) {
die("<span class='error'>File is not a zipped archive.</span>");
}
if (unlink($delete_me)) {
// successful deletion?
echo "Package {$delete_me} has been removed.<br>";
} else {
die("Problem removing package {$delete_me}.");
}
}
}
}
if ($view == "module") {
print getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_LOADER_TITLE']), false);
示例6: remove
function remove()
{
$json = getJSONobj();
$file = '';
if (isset($_REQUEST['file'])) {
$file = urldecode(hashToFile($_REQUEST['file']));
}
$GLOBALS['log']->debug("FILE TO REMOVE: " . $file);
if (!empty($file)) {
unlink($file);
}
echo 'result = ' . $json->encode(array('result' => 'true'));
}
示例7: testhashToFile
public function testhashToFile()
{
//execute the method and test if it returns expected values
//test with invalid hash.
$actual = hashToFile('');
$this->assertFalse($actual);
//test with a newly generated hash
$hash = fileToHash('config.php');
$actual = hashToFile($hash);
$this->assertSame('config.php', $actual);
}
示例8: remove
function remove()
{
require_once 'include/json_config.php';
$json_config = new json_config();
$json = getJSONobj();
$file = '';
if (isset($_REQUEST['file'])) {
$file = hashToFile($_REQUEST['file']);
}
$GLOBALS['log']->debug("FILE TO REMOVE: " . $file);
if (!empty($file)) {
unlink($file);
}
echo 'result = ' . $json->encode(array('result' => 'true'));
}