本文整理匯總了PHP中It::fullCopy方法的典型用法代碼示例。如果您正苦於以下問題:PHP It::fullCopy方法的具體用法?PHP It::fullCopy怎麽用?PHP It::fullCopy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類It
的用法示例。
在下文中一共展示了It::fullCopy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processUpdate
public function processUpdate()
{
$result = array();
$source_path = $this->file->getTempName();
$destination_path = dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . 'updates';
if (!is_dir($destination_path)) {
mkdir($destination_path, 0777);
}
$destination_path .= DIRECTORY_SEPARATOR . $this->update_version['stage'] . '_' . $this->update_version['sprint'] . '_' . $this->update_version['update'];
if (!is_dir($destination_path)) {
mkdir($destination_path, 0777);
}
$zip = new ZipArchive();
// open archive
if ($zip->open($source_path) !== TRUE) {
$result['errors'][] = 'Could not open archive';
} else {
$zip->extractTo($destination_path);
$result['total_entries'] = $zip->numFiles;
if (file_exists($destination_path . DIRECTORY_SEPARATOR . 'src') && file_exists($destination_path . DIRECTORY_SEPARATOR . 'update.ini')) {
It::fullCopy($destination_path . DIRECTORY_SEPARATOR . 'src', dirname(Yii::app()->request->scriptFile));
$update_ini = $destination_path . DIRECTORY_SEPARATOR . 'update.ini';
$values = parse_ini_file($update_ini, true);
InstallConfig::setConfigSection('version', $values['version']);
}
}
$zip->close();
return $result;
}
示例2: fullCopy
public static function fullCopy($source, $target)
{
if (is_dir($source)) {
if (!is_dir($target)) {
@mkdir($target);
}
$d = dir($source);
while (FALSE !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$Entry = $source . '/' . $entry;
if (is_dir($Entry)) {
It::fullCopy($Entry, $target . '/' . $entry);
continue;
}
copy($Entry, $target . '/' . $entry);
}
$d->close();
} else {
copy($source, $target);
}
}