本文整理汇总了PHP中Filesystem::SetPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::SetPermissions方法的具体用法?PHP Filesystem::SetPermissions怎么用?PHP Filesystem::SetPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filesystem
的用法示例。
在下文中一共展示了Filesystem::SetPermissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
// Update log
Filesystem::Write($log, "<p>Clean up…</p>\n");
### Setting required permissions
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/flv', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/mobile', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/thumbs', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/temp', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-content/uploads/avatars', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/logs', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/bin/qtfaststart', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/exceptions.py', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/__init__.py', 0777);
Filesystem::SetPermissions(DOC_ROOT . '/cc-core/system/qtfaststart/processor.py', 0777);
### Delete temp. dir.
Filesystem::Delete($tmp);
### Activate themes
### Activate plugins
Filesystem::Close();
unset($_SESSION['updates_available']);
Settings::Set('version', $update->version);
} catch (Exception $e) {
$error = $e->getMessage();
$page_title = 'Error During Update';
}
// Output Header
$dont_show_update_prompt = true;
include 'header.php';
?>
示例2: fopen
}
### Validate image data
$handle = fopen($_FILES['upload']['tmp_name'], 'r');
$image_data = fread($handle, filesize($_FILES['upload']['tmp_name']));
if (!@imagecreatefromstring($image_data)) {
throw new Exception(Language::GetText('error_uploadify_extension'));
}
### Change permissions on avatar & delete previous IF/APP
try {
Filesystem::Open();
$avatar_path = UPLOAD_PATH . '/avatars';
$save_as = Avatar::CreateFilename($extension);
Avatar::SaveAvatar($_FILES['upload']['tmp_name'], $extension, $save_as);
// Check for existing avatar
if (!empty($user->avatar)) {
Avatar::Delete($user->avatar);
}
Filesystem::SetPermissions("{$avatar_path}/{$save_as}", 0644);
Filesystem::Close();
} catch (Exception $e) {
App::Alert('Error During Avatar Upload', $e->getMessage());
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Update User
$user->Update(array('avatar' => $save_as));
Plugin::Trigger('update_profile.update_avatar');
// Output success message
exit(json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_avatar_updated'), 'other' => $user->avatar_url)));
} catch (Exception $e) {
exit(json_encode(array('result' => 0, 'msg' => $e->getMessage())));
}
示例3: Exception
// Debug Log
$config->debug_conversion ? App::Log(CONVERSION_LOG, 'Verifying temp Mobile file was created...') : null;
### Verify temp Mobile video was created successfully
if (!file_exists($mobile_temp) || filesize($mobile_temp) < 1024 * 5) {
throw new Exception("The temp Mobile file was not created. The id of the video is: {$video->video_id}");
}
/////////////////////////////////////////////////////////////
// STEP 4 //
// Shift Moov atom on Mobile video //
/////////////////////////////////////////////////////////////
// Debug Log
$config->debug_conversion ? App::Log(CONVERSION_LOG, "\nChecking qt-faststart permissions...") : null;
if ((string) substr(sprintf('%o', fileperms($qt_faststart_path)), -4) != '0777') {
try {
Filesystem::Open();
Filesystem::SetPermissions($qt_faststart_path, 0777);
Filesystem::Close();
} catch (Exception $e) {
throw new Exception("Unable to update permissions for qt-faststart. Please make sure it ({$qt_faststart_path}) has 777 executeable permissions.\n\nAdditional information: " . $e->getMessage());
}
}
// Debug Log
$config->debug_conversion ? App::Log(CONVERSION_LOG, "\nShifting moov atom on Mobile video...") : null;
### Execute Faststart Command
$faststart_command = "{$qt_faststart_path} {$mobile_temp} {$mobile} >> {$debug_log} 2>&1";
Plugin::Trigger('encode.before_faststart');
// Debug Log
$log_msg = "\n\n\n\n==================================================================\n";
$log_msg .= "FASTSTART\n";
$log_msg .= "==================================================================\n\n";
$log_msg .= "Faststart Command: {$faststart_command}\n";
示例4: Exception
$extension = Functions::GetExtension($_FILES['upload']['name']);
if (!preg_match("/{$extension}/i", Functions::GetVideoTypes('fileDesc'))) {
throw new Exception(Language::GetText('error_uploadify_extension'));
}
### Move video to site temp directory
$target = UPLOAD_PATH . '/temp/' . $video->filename . '.' . $extension;
Plugin::Trigger('upload.ajax.before_move_video');
if (!@move_uploaded_file($_FILES['upload']['tmp_name'], $target)) {
App::Alert('Error During Video Upload', 'The raw video file transfer failed. Video File: ' . $target);
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Change permissions on raw video file
Plugin::Trigger('upload.ajax.before_change_permissions');
try {
Filesystem::Open();
Filesystem::SetPermissions($target, 0644);
Filesystem::Close();
} catch (Exception $e) {
App::Alert('Error During Video Upload', $e->getMessage());
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Update video information
$data = array('status' => 'pending conversion', 'original_extension' => $extension);
Plugin::Trigger('upload.ajax.before_update_video');
$video->Update($data);
### Initilize Encoder
$cmd_output = $config->debug_conversion ? CONVERSION_LOG : '/dev/null';
Plugin::Trigger('upload.ajax.before_encode');
$converter_cmd = 'nohup ' . Settings::Get('php') . ' ' . DOC_ROOT . '/cc-core/system/encode.php --video="' . $video->video_id . '" >> ' . $cmd_output . ' 2>&1 &';
exec($converter_cmd);
Plugin::Trigger('upload.ajax.encode');
示例5: error
### Check for upload errors
if ($_FILES['upload']['error'] != 0) {
App::Alert('Error During Plugin Upload', 'There was an HTTP FILE POST error (Error code #' . $_FILES['upload']['error'] . ').');
throw new Exception('error');
}
### Validate filesize
if ($_FILES['upload']['size'] > 1024 * 1024 * 100 || filesize($_FILES['upload']['tmp_name']) > 1024 * 1024 * 100) {
throw new Exception('filesize');
}
### Validate video extension
$extension = Functions::GetExtension($_FILES['upload']['name']);
if ($extension != 'zip') {
throw new Exception('extension');
}
### Move video to site temp directory
// Create temp dir
$temp = DOC_ROOT . '/cc-content/.add-plugin';
Filesystem::Open();
Filesystem::CreateDir($temp);
Filesystem::SetPermissions($temp, 0777);
// Move zip to temp dir
if (!@move_uploaded_file($_FILES['upload']['tmp_name'], $temp . '/plugin.zip')) {
App::Alert('Uploaded file could not be moved from OS temp directory');
throw new Exception('error');
}
} catch (Exception $e) {
exit(json_encode(array('status' => $e->getMessage(), 'message' => '')));
}
### Notify Uploadify of success
$_SESSION['upload'] = serialize(array('key' => $upload_key, 'name' => $_FILES['upload']['name'], 'temp' => $temp . '/plugin.zip'));
exit(json_encode(array('status' => 'success', 'message' => $_FILES['upload']['name'])));