本文整理汇总了PHP中main::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP main::mkdir方法的具体用法?PHP main::mkdir怎么用?PHP main::mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::mkdir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: s3
private function s3()
{
$amazon_option = get_option(PREFIX_AS3B . 'setting');
if ($amazon_option) {
require_once main::getPluginDir() . '/libs/classes/aws-autoloader.php';
try {
$dir = BACKUP_DIR . '/' . $this->params['name'];
$credentials = new Aws\Common\Credentials\Credentials($amazon_option['access_key_id'], $amazon_option['secret_access_key']);
$client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
main::log(lang::get("Get Files for Resore Backup", false));
$keys = $client->listObjects(array('Bucket' => $amazon_option['bucket'], 'Prefix' => $this->params['name']))->getIterator();
//->getPath('Contents/*/Key');
if (isset($keys['Contents'])) {
$n = count($keys['Contents']);
main::mkdir($dir);
main::log(lang::get("Start Download files with Amazon S3", false));
for ($i = 0; $i < $n; $i++) {
$path = explode("/", $keys['Contents'][$i]['Key']);
if (isset($path[0]) && isset($path[1]) && !empty($path[1])) {
$result = $client->getObject(array('Bucket' => $amazon_option['bucket'], 'Key' => $keys['Contents'][$i]['Key'], 'SaveAs' => BACKUP_DIR . '/' . $keys['Contents'][$i]['Key']));
main::log(str_replace("%s", $keys['Contents'][$i]['Key'], lang::get("Download file - %s", false)));
}
}
main::log(lang::get("End downloads files with Amazon S3", false));
$this->local();
if (is_dir($dir)) {
main::remove($dir);
}
} else {
$this->setError(lang::get("Error, in downloads with Amazon S3", false));
}
} catch (Exception $e) {
$this->setError($e->getMessage());
} catch (S3Exception $e) {
$this->setError($e->getMessage());
}
} else {
$this->setError(lang::get('Error: Data is not exist for send backup files to Amazon S3. Please type your Data in the Settings form', false));
}
}