本文整理汇总了PHP中Configurations::setDirectoryStructureVer方法的典型用法代码示例。如果您正苦于以下问题:PHP Configurations::setDirectoryStructureVer方法的具体用法?PHP Configurations::setDirectoryStructureVer怎么用?PHP Configurations::setDirectoryStructureVer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configurations
的用法示例。
在下文中一共展示了Configurations::setDirectoryStructureVer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgradeCasesDirectoryStructure
//.........这里部分代码省略.........
} else {
CLI::logging(CLI::error("Error: Failure at coping from $UIdDir...\n"));
}
} else {
CLI::logging("$UIdDir is empty, removing it\n");
rmdir($UIdDir);//remove the diretory itself
}
}
}
//Start '0' directory migration
$black = PATH_DOCUMENT . $blackHoleDir . '/';
if (is_dir($black)) {
$newpattern = array();
$file = glob($black . '*.*');//files only
$dirlen = count($file);
for ($index = 0; $index < $dirlen; $index++) {
$levelfile = explode('/', $file[$index]);
$lastlevel = sizeof($levelfile);
$goalFile = $levelfile[$lastlevel - 1];
$newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);
CLI::logging("Migrating $blackHoleDir file: $goalFile\n");
G::mk_dir($blackHoleDir . PATH_SEP . $newpattern[0], 0777);
//echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;
if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {
unlink($file[$index]);
} else {
CLI::logging(CLI::error("Error: Failure at copy $file[$index] files...\n"));
}
}
}
//Set value of 2 to the directory structure version.
$this->initPropel(true);
G::LoadClass("configuration");
$conf = new Configurations();
if (!$conf->exists("ENVIRONMENT_SETTINGS")) {
$conf->aConfig = array ("format" => '@userName (@firstName @lastName)',
"dateFormat" => 'd/m/Y',
"startCaseHideProcessInf" => false,
"casesListDateFormat" => 'Y-m-d H:i:s',
"casesListRowNumber" => 25,
"casesListRefreshTime" => 120 );
$conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' );
}
$conf->setDirectoryStructureVer(2);
CLI::logging(CLI::info("Version Directory Structure is 2 now.\n"));
}
示例2: upgradeCasesDirectoryStructure
/**
* fix the 32K issue, by migrating /files directory structure to an uid tree structure based.
* @param $workspace got the site(s) the manager wants to upgrade
*/
public function upgradeCasesDirectoryStructure($workspace)
{
define('PATH_DOCUMENT', PATH_DATA . 'sites/' . $workspace . '/' . 'files/');
$doclevel = explode('/', PATH_DOCUMENT);
$length = sizeof(PATH_DOCUMENT);
$filesDir = $doclevel[$length - 1];
if (is_dir(PATH_DOCUMENT) && is_writable($filesDir)) {
CLI::logging(CLI::error("Error:" . PATH_DOCUMENT . " is not writable... please check the su permissions.\n"));
return;
}
$directory = array();
$blackHoleDir = G::getBlackHoleDir();
$directory = glob(PATH_DOCUMENT . "*", GLOB_ONLYDIR);
$dirslength = sizeof($directory);
if (!@chdir(PATH_DOCUMENT)) {
CLI::logging(CLI::error("Cannot use Document directory. The upgrade must be done as root.\n"));
return;
}
//Start migration
for ($index = 0; $index < $dirslength; $index++) {
$depthdirlevel = explode('/', $directory[$index]);
$lastlength = sizeof($depthdirlevel);
$UIdDir = $depthdirlevel[$lastlength - 1];
$lenDir = strlen($UIdDir);
if ($lenDir == 32 && $UIdDir != $blackHoleDir) {
$len = count(scandir($UIdDir));
if ($len > 2) {
//lenght = 2, because the function check . and .. dir links
$newDiretory = G::getPathFromUIDPlain($UIdDir);
CLI::logging("Migrating {$UIdDir} to {$newDiretory}\n");
G::mk_dir($newDiretory);
//echo `cp -R $UIdDir/* $newDiretory/`;
if (G::recursive_copy($UIdDir, $newDiretory)) {
CLI::logging("Removing {$UIdDir}...\n");
G::rm_dir($UIdDir);
rmdir($UIdDir);
//remove the diretory itself, G::rm_dir cannot do it
} else {
CLI::logging(CLI::error("Error: Failure at coping from {$UIdDir}...\n"));
}
} else {
CLI::logging("{$UIdDir} is empty, removing it\n");
rmdir($UIdDir);
//remove the diretory itself
}
}
}
//Start '0' directory migration
$black = PATH_DOCUMENT . $blackHoleDir . '/';
if (is_dir($black)) {
$newpattern = array();
$file = glob($black . '*.*');
//files only
$dirlen = count($file);
for ($index = 0; $index < $dirlen; $index++) {
$levelfile = explode('/', $file[$index]);
$lastlevel = sizeof($levelfile);
$goalFile = $levelfile[$lastlevel - 1];
$newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);
CLI::logging("Migrating {$blackHoleDir} file: {$goalFile}\n");
G::mk_dir($blackHoleDir . '/' . $newpattern[0]);
//echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;
if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {
unlink($file[$index]);
} else {
CLI::logging(CLI::error("Error: Failure at copy {$file[$index]} files...\n"));
}
}
}
//Set value of 2 to the directory structure version.
$this->initPropel(true);
G::LoadClass("configuration");
$conf = new Configurations();
if ($conf->exists("ENVIRONMENT_SETTINGS")) {
$conf->setDirectoryStructureVer(2);
CLI::logging(CLI::info("Version Directory Structure is 2 now.\n"));
} else {
CLI::logging(CLI::error("Error: found at try to use ENVIRONMENT_SETTINGS row.\n"));
return;
}
}