当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::chmod方法代码示例

本文整理汇总了PHP中Folder::chmod方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::chmod方法的具体用法?PHP Folder::chmod怎么用?PHP Folder::chmod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder::chmod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload

 public function upload(Model $Model, $arquivo = array(), $altura = 800, $largura = 600, $pasta = null, $nome_arquivo)
 {
     // App::uses('Vendor', 'wideimage');
     App::import('Vendor', 'WideImage', array('file' => 'WideImage' . DS . 'WideImage.php'));
     App::uses('Folder', 'Utility');
     $ext = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/x-jps', 'image/png', 'image/gif');
     if ($arquivo['error'] != 0 || $arquivo['size'] == 0) {
         return false;
     }
     $img = WideImage::load($arquivo['tmp_name']);
     $folder = new Folder();
     $pathinfo = pathinfo($arquivo['name']);
     if ($folder->create(WWW_ROOT . 'img' . DS . $pasta . DS)) {
         //se conseguiu criar o diretório eu dou permissão
         $folder->chmod(WWW_ROOT . 'img' . DS . $pasta . DS, 0755, true);
     } else {
         return false;
     }
     $pathinfo['filename'] = strtolower(Inflector::slug($pathinfo['filename'], '-'));
     $arquivo['name'] = $nome_arquivo . '.' . $pathinfo['extension'];
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . 'original_' . $arquivo['name']);
     $img = $img->resize($largura, $altura, 'fill');
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . $arquivo['name']);
     // debug(WWW_ROOT.'img'.DS.$pasta.DS.$arquivo['name']); die;
     return $arquivo['name'];
 }
开发者ID:vitorrampazzo,项目名称:cms,代码行数:26,代码来源:UploadBehavior.php

示例2: admin_add

 /**
  * テーマをアップロードして適用する
  */
 public function admin_add()
 {
     $this->pageTitle = 'テーマアップロード';
     $this->subMenuElements = array('themes');
     if ($this->request->data) {
         if (empty($this->request->data['Theme']['file']['tmp_name'])) {
             $this->setMessage('ファイルのアップロードに失敗しました。', true);
         } else {
             $name = $this->request->data['Theme']['file']['name'];
             move_uploaded_file($this->request->data['Theme']['file']['tmp_name'], TMP . $name);
             exec('unzip -o ' . TMP . $name . ' -d ' . BASER_THEMES, $return);
             if (!empty($return[2])) {
                 $theme = str_replace('  inflating: ' . BASER_THEMES, '', $return[2]);
                 $theme = explode(DS, $theme);
                 $theme = $theme[0];
                 $themePath = BASER_THEMES . $theme;
                 $Folder = new Folder();
                 $Folder->chmod($themePath, 0777);
                 unlink(TMP . $name);
                 $this->_applyTheme($theme);
                 $this->redirect(array('action' => 'index'));
             } else {
                 $msg = 'アップロードしたZIPファイルの展開に失敗しました。';
                 exec('unzip 2>&1', $errs);
                 $msg .= '<br />' . implode('<br />', $errs);
                 $this->setMessage($msg, true);
             }
         }
     }
 }
开发者ID:hanhunhun,项目名称:hanlog,代码行数:33,代码来源:ThemesController.php

示例3: finishInstall

 /**
  * Finish install, set .installed file on
  * module path
  * 
  * @param string $module
  * @return boolean
  */
 public function finishInstall($module)
 {
     $modulePath = CLOGGY_PATH_MODULE . $module . DS;
     $modulePathInstalled = $modulePath . '.installed';
     $folder = new Folder();
     $folder->chmod($modulePath, 0755, true);
     $file = new File($modulePathInstalled);
     return $file->create();
 }
开发者ID:simaostephanie,项目名称:Cloggy,代码行数:16,代码来源:CloggyModuleInstallerComponent.php

示例4: setFolderPermissions

 function setFolderPermissions($folder, $permission = '0755')
 {
     if (is_string($folder)) {
         $folder = array($folder);
     }
     App::import('core', 'Folder');
     $return = true;
     foreach ($folder as $dir) {
         $dir = APP . str_replace('/', DS, $dir);
         //$dir = new Folder($dir, $permission);
         $Folder = new Folder($dir);
         if (!$Folder->chmod($dir, $permission)) {
             $this->validationErrors['dir'][] = 'Attenzione: la directory ' . $dir . ' deve avere i permessi di scrittura';
             $return = false;
         }
     }
     return $return;
 }
开发者ID:amerlini,项目名称:digigas-from-hg,代码行数:18,代码来源:installer.php

示例5: extract

 /**
  * ZIP を展開する
  *
  * @param $source
  * @param $target
  * @return bool
  */
 public function extract($source, $target)
 {
     $this->error = null;
     $this->topArchiveName = null;
     if ($this->Zip) {
         $result = $this->_extractByPhpLib($source, $target);
     } else {
         $result = $this->_extractByCommand($source, $target);
     }
     if ($result) {
         $extractedPath = $target . $this->topArchiveName;
         $Folder = new Folder();
         $Folder->chmod($extractedPath, 0777);
         return true;
     } else {
         return false;
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:25,代码来源:BcZip.php

示例6: execute

 /**
  * Checks that given project path does not already exist, and
  * finds the app directory in it. Then it calls bake() with that information.
  *
  * @param string $project Project path
  */
 public function execute()
 {
     $project = null;
     if (isset($this->args[0])) {
         $project = $this->args[0];
     }
     if ($project && isset($_SERVER['PWD'])) {
         $project = $_SERVER['PWD'] . DS . $project;
     }
     if (empty($this->params['skel'])) {
         $core = App::core('shells');
         $skelPath = dirname($core[0]) . DS . 'templates' . DS . 'skel';
         if (is_dir($skelPath) === true) {
             $this->params['skel'] = $skelPath;
         }
     }
     while (!$project) {
         $prompt = __("What is the full path for this app including the app directory name?\n Example:");
         $default = APP_PATH . 'myapp';
         $project = $this->in($prompt . $default, null, $default);
     }
     if ($project) {
         $response = false;
         while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) {
             $prompt = __('<warning>A project already exists in this location:</warning> %s Overwrite?', $project);
             $response = $this->in($prompt, array('y', 'n'), 'n');
             if (strtolower($response) === 'n') {
                 $response = $project = false;
             }
         }
     }
     $success = true;
     if ($this->bake($project)) {
         $path = Folder::slashTerm($project);
         if ($this->createHome($path)) {
             $this->out(__(' * Welcome page created'));
         } else {
             $this->err(__('The Welcome page was <error>NOT</error> created'));
             $success = false;
         }
         if ($this->securitySalt($path) === true) {
             $this->out(__(' * Random hash key created for \'Security.salt\''));
         } else {
             $this->err(__('Unable to generate random hash for \'Security.salt\', you should change it in %s', CONFIGS . 'core.php'));
             $success = false;
         }
         if ($this->securityCipherSeed($path) === true) {
             $this->out(__(' * Random seed created for \'Security.cipherSeed\''));
         } else {
             $this->err(__('Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', CONFIGS . 'core.php'));
             $success = false;
         }
         if ($this->corePath($path) === true) {
             $this->out(__(' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
             $this->out(__(' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
             $this->out(__('   * <warning>Remember to check these value after moving to production server</warning>'));
         } else {
             $this->err(__('Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS . 'index.php'));
             $success = false;
         }
         if ($this->consolePath($path) === true) {
             $this->out(__(' * app/console/cake.php path set.'));
         } else {
             $this->err(__('Unable to set console path for app/console.'));
             $success = false;
         }
         $Folder = new Folder($path);
         if (!$Folder->chmod($path . 'tmp', 0777)) {
             $this->err(__('Could not set permissions on %s', $path . DS . 'tmp'));
             $this->out(__('chmod -R 0777 %s', $path . DS . 'tmp'));
             $success = false;
         }
         if ($success) {
             $this->out(__('<success>Project baked successfully!</success>'));
         } else {
             $this->out(__('Project baked but with <warning>some issues.</warning>.'));
         }
         return $path;
     }
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:86,代码来源:project.php

示例7: while

 /**
  * Looks for a skeleton template of a Cake application,
  * and if not found asks the user for a path. When there is a path
  * this method will make a deep copy of the skeleton to the project directory.
  * A default home page will be added, and the tmp file storage will be chmod'ed to 0777.
  *
  * @param string $path Project path
  * @access private
  */
 function __buildDirLayout($path)
 {
     $skel = $this->params['skel'];
     while ($skel == '') {
         $skel = $this->in("What is the path to the app directory you wish to copy?\nExample: " . APP, null, ROOT . DS . 'myapp' . DS);
         if ($skel == '') {
             $this->out('The directory path you supplied was empty. Please try again.');
         } else {
             while (is_dir($skel) === false) {
                 $skel = $this->in('Directory path does not exist please choose another:');
             }
         }
     }
     $app = basename($path);
     $this->out('Bake Project');
     $this->out("Skel Directory: {$skel}");
     $this->out("Will be copied to: {$path}");
     $this->hr();
     $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
     if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
         $verboseOuptut = $this->in('Do you want verbose output?', array('y', 'n'), 'n');
         $verbose = false;
         if (low($verboseOuptut) == 'y' || low($verboseOuptut) == 'yes') {
             $verbose = true;
         }
         $Folder = new Folder($skel);
         if ($Folder->copy($path)) {
             $path = $Folder->slashTerm($path);
             $this->hr();
             $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
             $this->hr();
             if ($this->createHome($path)) {
                 $this->out('Welcome page created');
             } else {
                 $this->out('The Welcome page was NOT created');
             }
             if ($this->securitySalt($path) === true) {
                 $this->out('Random hash key created for \'Security.salt\'');
             } else {
                 $this->err('Unable to generate random hash for \'Security.salt\', please change this yourself in ' . CONFIGS . 'core.php');
             }
             $corePath = $this->corePath($path);
             if ($corePath === true) {
                 $this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
             } elseif ($corePath === false) {
                 $this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' . DS . 'index.php');
             }
             if (!$Folder->chmod($path . 'tmp', 0777)) {
                 $this->err('Could not set permissions on ' . $path . DS . 'tmp');
                 $this->out('You must manually check that these directories can be wrote to by the server');
             }
         } else {
             $this->err(" '" . $app . "' could not be created properly");
         }
         if ($verbose) {
             foreach ($Folder->messages() as $message) {
                 $this->out($message);
             }
         }
         return;
     } elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
         $this->out('Bake Aborted.');
     } else {
         $this->params['working'] = null;
         $this->params['app'] = null;
         $this->execute(false);
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:77,代码来源:project.php

示例8: admin_add

 /**
  * プラグインをアップロードしてインストールする
  *
  * @return void
  */
 public function admin_add()
 {
     $this->pageTitle = 'プラグインアップロード';
     $this->subMenuElements = array('plugins');
     if ($this->request->data) {
         if (empty($this->request->data['Plugin']['file']['tmp_name'])) {
             $this->setMessage('ファイルのアップロードに失敗しました。', true);
         } else {
             $name = $this->request->data['Plugin']['file']['name'];
             move_uploaded_file($this->request->data['Plugin']['file']['tmp_name'], TMP . $name);
             exec('unzip -o ' . TMP . $name . ' -d ' . APP . 'Plugin' . DS, $return);
             if (!empty($return[2])) {
                 $plugin = preg_replace('/^\\s*?(creating|inflating):\\s*' . preg_quote(APP . 'Plugin' . DS, '/') . '/', '', $return[2]);
                 $plugin = explode(DS, $plugin);
                 $plugin = $plugin[0];
                 $pluginPath = BASER_THEMES . $plugin;
                 $Folder = new Folder();
                 $Folder->chmod($pluginPath, 0777);
                 $plugin = Inflector::camelize($plugin);
                 $Folder->move(array('to' => BASER_THEMES . $plugin, 'from' => $pluginPath, 'mode' => 0777));
                 unlink(TMP . $name);
                 // プラグインをインストール
                 if ($this->BcManager->installPlugin($plugin)) {
                     clearAllCache();
                     $this->setMessage('新規プラグイン「' . $plugin . '」を baserCMS に登録しました。', false, true);
                     $this->redirect(array('action' => 'index'));
                 } else {
                     $this->setMessage('プラグインに問題がある為インストールを完了できません。プラグインの開発者に確認してください。', true);
                 }
             } else {
                 $msg = 'アップロードしたZIPファイルの展開に失敗しました。';
                 exec('unzip 2>&1', $errs);
                 $msg .= '<br />' . implode('<br />', $errs);
                 $this->setMessage($msg, true);
                 $this->redirect(array('action' => 'add'));
             }
         }
     }
 }
开发者ID:kenz,项目名称:basercms,代码行数:44,代码来源:PluginsController.php

示例9: _createSubFolder

 /**
  * Create sub folder
  * 
  * @param  string $subFolderPath
  * @return void
  */
 protected static function _createSubFolder($subFolderPath)
 {
     if (!is_dir($subFolderPath)) {
         $dir = new Folder();
         $dir->create($subFolderPath);
         $dir->chmod($subFolderPath, '777');
     }
 }
开发者ID:vladshish,项目名称:cakephp-favicon-plugin,代码行数:14,代码来源:Favicon.php

示例10: apply

 /**
  * Applies this CHMOD to the specified file or folder.
  *
  * The script will abort if no CHMOD is set.
  *
  * @param	mixed	Path to the file or directory
  * @return	boolean	Returns TRUE on success or FALSE on failure.
  */
 public function apply($path)
 {
     if (is_dir($path) == true) {
         $dir = new Folder(path);
         return $dir->chmod($this);
     } else {
         $file = new File($path);
         return $file->chmod($this);
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:18,代码来源:class.CHMOD.php

示例11: testChmod

 /**
  * testChmod method
  *
  * @return void
  */
 public function testChmod()
 {
     $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'Folder permissions tests not supported on Windows.');
     $path = TMP;
     $Folder = new Folder($path);
     $subdir = 'test_folder_new';
     $new = TMP . $subdir;
     $this->assertTrue($Folder->create($new));
     $this->assertTrue($Folder->create($new . DS . 'test1'));
     $this->assertTrue($Folder->create($new . DS . 'test2'));
     $filePath = $new . DS . 'test1.php';
     $File = new File($filePath);
     $this->assertTrue($File->create());
     $filePath = $new . DS . 'skip_me.php';
     $File = new File($filePath);
     $this->assertTrue($File->create());
     $this->assertTrue($Folder->chmod($new, 0755, true));
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4);
     $this->assertEquals('0755', $perms);
     $this->assertTrue($Folder->chmod($new, 0744, true, array('skip_me.php', 'test2')));
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4);
     $this->assertEquals('0755', $perms);
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test1')), -4);
     $this->assertEquals('0744', $perms);
     $Folder->delete($new);
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:31,代码来源:FolderTest.php

示例12: admin_add

 /**
  * プラグインをアップロードしてインストールする
  *
  * @return void
  */
 public function admin_add()
 {
     $this->pageTitle = 'プラグインアップロード';
     $this->subMenuElements = array('plugins');
     //データなし
     if (empty($this->request->data)) {
         return;
     }
     //アップロード失敗
     if (empty($this->request->data['Plugin']['file']['tmp_name'])) {
         $this->setMessage('ファイルのアップロードに失敗しました。', true);
         return;
     }
     $zippedName = $this->request->data['Plugin']['file']['name'];
     move_uploaded_file($this->request->data['Plugin']['file']['tmp_name'], TMP . $zippedName);
     App::uses('BcZip', 'Lib');
     $BcZip = new BcZip();
     if (!$BcZip->extract(TMP . $zippedName, APP . 'Plugin' . DS)) {
         $msg = 'アップロードしたZIPファイルの展開に失敗しました。';
         $msg .= '<br />' . $BcZip->error;
         $this->setMessage($msg, true);
         $this->redirect(array('action' => 'add'));
         return;
     }
     $plugin = $BcZip->topArchiveName;
     // 解凍したプラグインフォルダがキャメルケースでない場合にキャメルケースに変換
     $plugin = preg_replace('/^\\s*?(creating|inflating):\\s*' . preg_quote(APP . 'Plugin' . DS, '/') . '/', '', $plugin);
     $plugin = explode(DS, $plugin);
     $plugin = $plugin[0];
     $srcPluginPath = APP . 'Plugin' . DS . $plugin;
     $Folder = new Folder();
     $Folder->chmod($srcPluginPath, 0777);
     $tgtPluginPath = APP . 'Plugin' . DS . Inflector::camelize($plugin);
     if ($srcPluginPath != $tgtPluginPath) {
         $Folder->move(array('to' => $tgtPluginPath, 'from' => $srcPluginPath, 'mode' => 0777));
     }
     unlink(TMP . $zippedName);
     // プラグインをインストール
     if ($this->BcManager->installPlugin($plugin)) {
         clearAllCache();
         $this->setMessage('新規プラグイン「' . $plugin . '」を baserCMS に登録しました。', false, true);
         $this->Plugin->addFavoriteAdminLink($plugin, $this->BcAuth->user());
         $this->redirect(array('action' => 'index'));
     } else {
         $this->setMessage('プラグインに問題がある為インストールを完了できません。プラグインの開発者に確認してください。', true);
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:52,代码来源:PluginsController.php

示例13: getFieldBasename

 /**
  * フィールドベースのファイル名を取得する
  *
  * @param Model $Model
  * @param array $setting
  * @param string $ext
  * @return mixed false / string
  * @access public
  */
 public function getFieldBasename(Model $Model, $setting, $ext)
 {
     if (empty($setting['namefield'])) {
         return false;
     }
     $data = $Model->data[$Model->alias];
     if (!isset($data[$setting['namefield']])) {
         if ($setting['namefield'] == 'id' && $Model->id) {
             $basename = $Model->id;
         } else {
             return false;
         }
     } else {
         $basename = $data[$setting['namefield']];
     }
     if (!empty($setting['nameformat'])) {
         $basename = sprintf($setting['nameformat'], $basename);
     }
     if (!isset($setting['nameadd']) || $setting['nameadd'] !== false) {
         $basename .= '_' . $setting['name'];
     }
     $subdir = '';
     if (!empty($this->settings[$Model->alias]['subdirDateFormat'])) {
         $subdir = date($this->settings[$Model->alias]['subdirDateFormat']);
         if (!preg_match('/\\/$/', $subdir)) {
             $subdir .= '/';
         }
         $subdir = str_replace('/', DS, $subdir);
         $path = $this->savePath[$Model->alias] . $subdir;
         if (!is_dir($path)) {
             $Folder = new Folder();
             $Folder->create($path);
             $Folder->chmod($path, 0777);
         }
     }
     return $subdir . $basename . '.' . $ext;
 }
开发者ID:kenz,项目名称:basercms,代码行数:46,代码来源:BcUploadBehavior.php

示例14: checkDirectory

	/**
	 * Check the destination folder. If it does not exist or isn't writable, fix it!
	 *
	 * @access public
	 * @uses Folder
	 * @return void
	 */
	public function checkDirectory() {
		$Folder = new Folder();
		$uploadDir = trim($this->uploadDir, '/');
		$finalDir = $this->formatPath($uploadDir .'/');

		if (!is_dir($finalDir)) {
			$dirParts = explode('/', $uploadDir);
			$dirCurrent = rtrim($this->baseDir, '/');

			foreach ($dirParts as $part) {
				$Folder->create($dirCurrent . DS . $part, 0777);
				$dirCurrent .= DS . $part;
			}
		} else if (!is_writable($finalDir)) {
			$Folder->chmod($finalDir, 0777, false);
		}

		$this->finalDir = $finalDir;
	}
开发者ID:robksawyer,项目名称:FIND---GET---MAKE,代码行数:26,代码来源:uploader.php

示例15: __proceedFileName

 /**
  * Check file name and setup filepath
  */
 private function __proceedFileName()
 {
     //get error status
     $checkError = $this->isError();
     if (!$checkError) {
         $filename = $this->__uploadData['name'];
         if (empty($this->__folderDestPath)) {
             $this->setupError(__d('cloggy', 'Folder destination not configured.'));
         } else {
             /*
              * create folder if not exists
              */
             if (!is_dir($this->__folderDestPath)) {
                 /*
                  * create folder
                  */
                 $folder = new Folder();
                 $folder->create($this->__folderDestPath);
                 $folder->chmod($this->__folderDestPath, 0755);
             }
             $filepath = $this->__folderDestPath . $filename;
             /*
              * check if exists
              */
             if (file_exists($filepath)) {
                 /*
                  * raise an error if forDupFile set to false
                  * and there is an existed file
                  */
                 if ($this->__forceDupFile) {
                     $filename = $this->__rewriteFile($filename);
                     $this->__filepath = $this->__folderDestPath . $filename;
                 } else {
                     $this->setupError(__d('cloggy', 'Cannot upload file due to duplicate file.'));
                 }
             } else {
                 $this->__filepath = $filepath;
             }
         }
     }
 }
开发者ID:simaostephanie,项目名称:Cloggy,代码行数:44,代码来源:CloggyFileUploadComponent.php


注:本文中的Folder::chmod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。