本文整理匯總了PHP中Cx\Lib\FileSystem\FileSystem::copy_folder方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSystem::copy_folder方法的具體用法?PHP FileSystem::copy_folder怎麽用?PHP FileSystem::copy_folder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cx\Lib\FileSystem\FileSystem
的用法示例。
在下文中一共展示了FileSystem::copy_folder方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _podcastUpdate
function _podcastUpdate()
{
global $objDatabase, $_ARRAYLANG, $objUpdate, $_CONFIG;
//move podcast images directory
$path = ASCMS_DOCUMENT_ROOT . '/images';
$oldImagesPath = '/content/podcast';
$newImagesPath = '/podcast';
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '1.2.1')) {
if (!file_exists($path . $newImagesPath) && file_exists($path . $oldImagesPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $oldImagesPath);
if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($path . $oldImagesPath, $path . $newImagesPath)) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_TO_MOVE_DIRECTORY'], $path . $oldImagesPath, $path . $newImagesPath));
return false;
}
}
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath);
\Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath . '/youtube_thumbnails');
//change thumbnail paths
$query = "UPDATE `" . DBPREFIX . "module_podcast_medium` SET `thumbnail` = REPLACE(`thumbnail`, '/images/content/podcast/', '/images/podcast/')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
//set new default settings
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '50' WHERE `setname` = 'thumb_max_size' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
$query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '85' WHERE `setname` = 'thumb_max_size_homecontent' AND `setvalue` = ''";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
// only update if installed version is at least a version 2.0.0
// older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled
if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) {
try {
// migrate content page to version 3.0.1
$search = array('/(.*)/ms');
$callback = function ($matches) {
$content = $matches[1];
if (empty($content)) {
return $content;
}
// add missing placeholder {PODCAST_JAVASCRIPT}
if (strpos($content, '{PODCAST_JAVASCRIPT}') === false) {
$content .= "\n{PODCAST_JAVASCRIPT}";
}
// add missing placeholder {PODCAST_PAGING}
if (strpos($content, '{PODCAST_PAGING}') === false) {
$content = preg_replace('/(\\s+)(<!--\\s+END\\s+podcast_media\\s+-->)/ms', '$1$2$1<div class="noMedium">$1 {PODCAST_PAGING}$1</div>', $content);
}
return $content;
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'podcast'), $search, $callback, array('content'), '3.0.1');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
}
return true;
}
示例2: internalFsRelocate
/**
* Moves or copies the filesystem part of this component to another location
* @param string $destination Destination path
* @param boolean $copy (optional) Copy or move? True means copy, default is move
* @return null
*/
protected function internalFsRelocate($destination, $copy = false)
{
if ($destination == $this->getDirectory()) {
// nothing to do
return;
}
$status = false;
if ($copy) {
$status = \Cx\Lib\FileSystem\FileSystem::copy_folder($this->getDirectory(), $destination);
} else {
$status = \Cx\Lib\FileSystem\FileSystem::move($this->getDirectory(), $destination);
}
return $status;
}
示例3: createdir
/**
* create skin folder
* @access public
*/
private function createdir()
{
global $_ARRAYLANG;
\Permission::checkAccess(47, 'static');
$themeName = !empty($_POST['dbName']) && !stristr($_POST['dbName'], '..') ? contrexx_input2raw($_POST['dbName']) : null;
$copyFromTheme = !empty($_POST['fromTheme']) && !stristr($_POST['fromTheme'], '..') ? contrexx_input2raw($_POST['fromTheme']) : null;
$createFromDatabase = !empty($_POST['fromDB']) && !stristr($_POST['fromDB'], '..') ? contrexx_input2raw($_POST['fromDB']) : null;
$dirName = !empty($_POST['dirName']) && !stristr($_POST['dirName'], '..') ? contrexx_input2raw($_POST['dirName']) : null;
$dirName = \Cx\Lib\FileSystem\FileSystem::replaceCharacters($dirName);
if (!$themeName) {
$this->strErrMessage = $_ARRAYLANG['TXT_STATUS_CHECK_INPUTS'];
$this->newdir();
return;
}
$this->validateThemeName($themeName);
if (!empty($dirName)) {
// ensure that we're creating a new directory and not trying to overwrite an existing one
$suffix = '';
while (file_exists($this->path . $dirName . $suffix)) {
$suffix++;
}
$dirName .= $suffix;
$theme = new \Cx\Core\View\Model\Entity\Theme();
$theme->setThemesname($themeName);
$theme->setFoldername($dirName);
switch (true) {
case empty($copyFromTheme) && empty($createFromDatabase):
// Create new empty theme
if (\Cx\Lib\FileSystem\FileSystem::make_folder($this->path . $theme->getFoldername())) {
if ($this->createDefaultFiles($theme) && $this->insertSkinIntoDb($theme)) {
\Message::add(contrexx_raw2xhtml($themeName) . ' ' . $_ARRAYLANG['TXT_STATUS_SUCCESSFULLY_CREATE']);
} else {
\Message::add($_ARRAYLANG['TXT_MSG_ERROR_NEW_DIR'], \Message::CLASS_ERROR);
$this->newdir();
return;
}
}
break;
case !empty($copyFromTheme) && empty($createFromDatabase):
//check Whether the folder exists in both codebase
if ($this->codeBaseThemesPath != $this->websiteThemesPath && file_exists($this->codeBaseThemesPath . $copyFromTheme)) {
if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($this->codeBaseThemesPath . $copyFromTheme, $this->websiteThemesPath . $dirName, true)) {
\Message::add($_ARRAYLANG['TXT_MSG_ERROR_NEW_DIR'], \Message::CLASS_ERROR);
$this->newdir();
return;
}
}
//check Whether the folder exists in website data repository
if (file_exists($this->websiteThemesPath . $copyFromTheme)) {
if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($this->websiteThemesPath . $copyFromTheme, $this->websiteThemesPath . $dirName, true)) {
\Message::add($_ARRAYLANG['TXT_MSG_ERROR_NEW_DIR'], \Message::CLASS_ERROR);
$this->newdir();
return;
}
}
$this->replaceThemeName($copyFromTheme, $dirName, $this->websiteThemesPath . $dirName);
//convert theme to component
try {
$this->themeRepository->loadComponentData($theme);
if (!$theme->isComponent()) {
// create a new one if no component.yml exists
try {
$this->themeRepository->convertThemeToComponent($theme);
} catch (\Exception $ex) {
\DBG::log($ex->getMessage());
\DBG::log($theme->getThemesname() . ' : Unable to convert theme to component');
}
$this->themeRepository->loadComponentData($theme);
}
// change the theme name in component data
$themeInformation = $theme->getComponentData();
if ($themeInformation) {
$themeInformation['name'] = $theme->getThemesname();
$theme->setComponentData($themeInformation);
$this->themeRepository->saveComponentData($theme);
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
\Message::add('Error in coverting component file', \Message::CLASS_ERROR);
}
if ($this->insertSkinIntoDb($theme)) {
\Message::add(contrexx_raw2xhtml($themeName) . ' ' . $_ARRAYLANG['TXT_STATUS_SUCCESSFULLY_CREATE']);
}
break;
case empty($copyFromTheme) && !empty($createFromDatabase):
// TODO: remove this function -> migrate all pending themes in the update process
// Create new theme from database (migrate existing theme from database to filesystem)
if (\Cx\Lib\FileSystem\FileSystem::make_folder($this->path . $dirName)) {
$this->insertIntoDb($theme, $createFromDatabase);
$this->createFilesFromDB($dirName, intval($createFromDatabase));
}
break;
default:
break;
}
// Theme build successfully
\Cx\Core\Csrf\Controller\Csrf::redirect('index.php?cmd=ViewManager&act=templates&themes=' . $theme->getFoldername());
//.........這裏部分代碼省略.........