本文整理汇总了PHP中tao_helpers_File::move方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_File::move方法的具体用法?PHP tao_helpers_File::move怎么用?PHP tao_helpers_File::move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tao_helpers_File
的用法示例。
在下文中一共展示了tao_helpers_File::move方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
*
* @param unknown $params
*/
public function __invoke($params)
{
if (count($params) != 2) {
return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Usage: %s DELIVERY_URI OUTPUT_FILE', __CLASS__));
}
$deliveryUri = array_shift($params);
$delivery = new \core_kernel_classes_Resource($deliveryUri);
if (!$delivery->exists()) {
return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Delivery \'%s\' not found', $deliveryUri));
}
$file = array_shift($params);
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
$tmpFile = Assembler::exportCompiledDelivery($delivery);
\tao_helpers_File::move($tmpFile, $file);
return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Exported %1$s to %2$s', $delivery->getLabel(), $file));
}
示例2: __invoke
/**
* (non-PHPdoc)
* @see \oat\oatbox\action\Action::__invoke()
*/
public function __invoke($params)
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
if (count($params) != 2) {
return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Usage: %s DELIVERY_CLASS_URI OUTPUT_DIRECTORY', __CLASS__));
}
$deliveryClassUri = array_shift($params);
$deliveryClass = new \core_kernel_classes_Class($deliveryClassUri);
$dir = array_shift($params);
if (!file_exists($dir) && !mkdir($dir)) {
return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Directory %s doesn\'t exist', $dir));
}
$dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$report = new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Exporting %s', $deliveryClass->getLabel()));
foreach ($deliveryClass->getInstances(true) as $delivery) {
$destFile = $dir . \tao_helpers_File::getSafeFileName($delivery->getLabel()) . '.zip';
$tmpFile = Assembler::exportCompiledDelivery($delivery);
\tao_helpers_File::move($tmpFile, $destFile);
$report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Exported %1$s to %2$s', $delivery->getLabel(), $destFile)));
}
return $report;
}
示例3: dirname
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2);
* 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER);
* 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV);
*
*/
require_once dirname(__FILE__) . '/../includes/raw_start.php';
$parms = $argv;
$script = array_shift($parms);
if (count($parms) != 2) {
echo "Usage: " . $script . " DELIVERY_URI OUTPUT_FILE\n";
} else {
$deliveryUri = array_shift($parms);
$file = array_shift($parms);
$delivery = new core_kernel_classes_Resource($deliveryUri);
$tmpFile = taoDelivery_models_classes_import_Assembler::exportCompiledDelivery($delivery);
tao_helpers_File::move($tmpFile, $file);
echo "Done";
}
示例4: getUploadedPackage
/**
* Return a valid uploaded file
*
* @return string
* @throws \common_Exception
* @throws \common_exception_Error
* @throws \common_exception_MissingParameter
* @throws \common_exception_BadRequest
* @throws \oat\tao\helpers\FileUploadException
*/
protected function getUploadedPackage()
{
if (!$this->hasRequestParameter(self::RESTITEM_PACKAGE_NAME)) {
throw new \common_exception_MissingParameter(self::RESTITEM_PACKAGE_NAME, __CLASS__);
}
$file = \tao_helpers_Http::getUploadedFile(self::RESTITEM_PACKAGE_NAME);
if (!in_array($file['type'], self::$accepted_types)) {
throw new \common_exception_BadRequest('Uploaded file has to be a valid archive.');
}
$pathinfo = pathinfo($file['tmp_name']);
$destination = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $file['name'];
\tao_helpers_File::move($file['tmp_name'], $destination);
return $destination;
}
示例5: unShield
/**
*
* @access
* @author "Lionel Lecaque, <lionel@taotesting.com>"
* @param unknown $ext
* @return boolean
*/
public function unShield($ext)
{
$extFolder = ROOT_PATH . DIRECTORY_SEPARATOR . $ext;
if (!is_file($extFolder . '/htaccess.1')) {
common_Logger::d('Previous lock, ' . $extFolder . '/htaccess.1 do not exits something may have go wrong, please check');
return false;
}
if (unlink($extFolder . '/.htaccess')) {
return tao_helpers_File::move($extFolder . '/htaccess.1', $extFolder . '/.htaccess', true, false);
} else {
common_Logger::i('Fail to remove htaccess in ' . $ext . ' . You may copy by hand file htaccess.1');
return false;
}
}