本文整理汇总了PHP中sfFilesystem::mkdirs方法的典型用法代码示例。如果您正苦于以下问题:PHP sfFilesystem::mkdirs方法的具体用法?PHP sfFilesystem::mkdirs怎么用?PHP sfFilesystem::mkdirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfFilesystem
的用法示例。
在下文中一共展示了sfFilesystem::mkdirs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createDataFolder
public function createDataFolder($dir = "")
{
$fileSystem = new sfFilesystem();
$oldumask = umask(0);
$fileSystem->mkdirs($this->getVisiteurDataPath(), 0755);
$fileSystem->chmod($this->getVisiteurDataPath(), 0755);
umask($oldumask);
if ($dir != '') {
$oldumask = umask(0);
$fileSystem->mkdirs($this->getVisiteurDataPath() . '/' . $dir, 0755);
$fileSystem->chmod($this->getVisiteurDataPath() . '/' . $dir, 0755);
umask($oldumask);
}
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$this->logSection('Create directory', "Visiteur");
$q = Doctrine_Query::create()->from('Visiteur v');
$visiteurs = $q->execute();
foreach ($visiteurs as $visiteur) {
$visiteur->createDataFolder();
}
$this->logSection('Create directory', "Interactif");
$q = Doctrine_Query::create()->from('Interactif i');
$interactifs = $q->execute();
foreach ($interactifs as $interactif) {
$interactif->createDataFolder();
}
$this->logSection('Create directory', "Exposition");
$q = Doctrine_Query::create()->from('Exposition v');
$expositions = $q->execute();
foreach ($expositions as $exposition) {
$exposition->createDataFolder();
}
$this->logSection('Create directory', "Medaille");
$fileSystem = new sfFilesystem();
$fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille");
$this->logSection('Create directory', "MedailleType");
$fileSystem = new sfFilesystem();
$fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille_type");
}
示例3: execute
public function execute($arguments = array(), $options = array())
{
$projectDir = UtilPsdf::fixPath($arguments['pjpath']);
$packagesDir = $projectDir . DIRECTORY_SEPARATOR . $arguments['pkpath'] . DIRECTORY_SEPARATOR;
if (is_dir($projectDir)) {
throw new sfCommandException(sprintf('The project "%s" already exists.', $projectDir));
}
$filesystem = new sfFilesystem();
// Create basic workspace structure
$skeletonDir = dirname(__FILE__) . '/../../data/generator/skeleton/psdfProject';
$finder = sfFinder::type('any')->discard('.sf');
$filesystem->mirror($skeletonDir, $projectDir, $finder);
// Actualizo tokens
$constants = array('PROJECT_NAME' => $arguments['pjname']);
$finder = sfFinder::type('file')->name('.project');
$filesystem->replaceTokens($finder->in($projectDir), '##', '##', $constants);
// Create packages files (subdir por cada macro)
$packages = $arguments['packages'];
foreach ($packages as $pack) {
if (!is_dir($packagesDir . $pack['macro'])) {
$filesystem->mkdirs($packagesDir . $pack['macro']);
}
$file = $packagesDir . $pack['macro'] . DIRECTORY_SEPARATOR . $pack['name'] . '.xpdl';
$filesystem->touch($file);
file_put_contents($file, $pack['xpdl']);
}
}
示例4: createDataFolder
public function createDataFolder()
{
$fileSystem = new sfFilesystem();
$oldumask = umask(0);
$fileSystem->mkdirs($this->getInteractifDataPath(), 0755);
$fileSystem->chmod($this->getInteractifDataPath(), 0755);
umask($oldumask);
}
示例5: createDataFolder
public function createDataFolder()
{
$fileSystem = new sfFilesystem();
$oldumask = umask(0);
$fileSystem->mkdirs($this->getExpositionDataPath(), 0777);
$fileSystem->chmod($this->getExpositionDataPath(), 0777);
umask($oldumask);
}
示例6: execute
public function execute($request)
{
$css = Doctrine::getTable('SnsConfig')->get('customizing_css');
$this->getResponse()->setContent($css);
$this->getResponse()->setContentType('text/css');
// cache
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
file_put_contents($dir . DIRECTORY_SEPARATOR . 'customizing.css', $css);
return sfView::NONE;
}
示例7: symlinkDocument
public function symlinkDocument($interactif_id, $visiteur_id, $filename, $target)
{
$interactifs_dir = sfConfig::get('sf_root_dir') . '/web/interactif';
$fileSystem = new sfFilesystem();
if (!file_exists($interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id . '/' . $filename)) {
if (!is_dir($interactifs_dir . '/' . $interactif_id)) {
$oldumask = umask(0);
$fileSystem->mkdirs($interactifs_dir . '/' . $interactif_id, 0755);
$fileSystem->chmod($interactifs_dir . '/' . $interactif_id, 0755);
umask($oldumask);
}
if (!is_dir($interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id)) {
$oldumask = umask(0);
$fileSystem->mkdirs($interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id, 0755);
$fileSystem->chmod($interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id, 0755);
umask($oldumask);
}
symlink($target, $interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id . '/' . $filename);
return true;
//exit;
}
return false;
}
示例8: cacheCss
public static function cacheCss($event, $content)
{
$lastEntry = sfContext::getInstance()->getActionStack()->getLastEntry();
if (!$lastEntry) {
return $content;
}
if ('opSkinClassicPlugin' === $lastEntry->getModuleName() && 'css' === $lastEntry->getActionName()) {
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
file_put_contents($dir . DIRECTORY_SEPARATOR . opSkinClassicConfig::getCurrentTheme() . '.css', $content);
}
return $content;
}
示例9: execute
protected function execute($arguments = array(), $options = array())
{
if (!extension_loaded('openssl')) {
throw Exception('this task requires the openssl php extension, see http://www.php.net/openssl');
}
$days = null;
while (!is_numeric($days)) {
$days = $this->ask('The Days of Validity (default:365)');
if (!$days) {
$days = 365;
}
}
while (!($phrase = $this->ask('Private Key Phrase'))) {
}
$country = null;
while (!($country = strtoupper($this->ask('Country Name (2 letter code)'))) || strlen($country) != 2) {
$this->logBlock('invalid format.', 'ERROR');
}
while (!($state = $this->ask('State or Province Name (full name)'))) {
}
while (!($locality = $this->ask('Locality Name (eg,city)'))) {
}
while (!($org = $this->ask('Organization Name(eg,company)'))) {
}
while (!($orgUnit = $this->ask('Organization Unit Name(eg,section)'))) {
}
while (!($common = $this->ask('Common Name(eg,Your name)'))) {
}
while (!($email = $this->ask('Email Address'))) {
}
$dn = array('countryName' => $country, 'stateOrProvinceName' => $state, 'localityName' => $locality, 'organizationName' => $org, 'organizationalUnitName' => $orgUnit, 'commonName' => $common, 'emailAddress' => $email);
$dirname = sfConfig::get('sf_plugins_dir') . '/opOpenSocialPlugin/certs';
$filesystem = new sfFilesystem($this->dispatcher, $this->formatter);
$filesystem->mkdirs($dirname);
$privatekey = openssl_pkey_new();
$csr = openssl_csr_new($dn, $privatekey);
$sscert = openssl_csr_sign($csr, null, $privatekey, $days);
openssl_x509_export($sscert, $certout);
openssl_pkey_export($privatekey, $pkeyout, $phrase);
$cert_filename = $dirname . '/public.crt';
file_put_contents($cert_filename, $certout);
$this->logSection('file+', $cert_filename);
$pkey_filename = $dirname . '/private.key';
file_put_contents($pkey_filename, $pkeyout);
$this->logSection('file+', $pkey_filename);
$databaseManager = new sfDatabaseManager($this->configuration);
Doctrine::getTable('SnsConfig')->set('shindig_private_key_phrase', $phrase);
}
示例10: execute
public function execute($request)
{
$css = Doctrine::getTable('SnsConfig')->get('customizing_css', '');
$this->getResponse()->setContent($css);
$this->getResponse()->setContentType('text/css');
// cache
$filesystem = new sfFilesystem();
$dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'css';
@$filesystem->mkdirs($dir);
$filesystem->chmod($dir, 0777);
$cssPath = $dir . DIRECTORY_SEPARATOR . 'customizing.css';
file_put_contents($cssPath, $css);
$filesystem->chmod($cssPath, 0666);
$this->getResponse()->setHttpHeader('Last-Modified', sfWebResponse::getDate(time()));
return sfView::NONE;
}
示例11: initializeMigration
/**
* Intializes a new migration.
*
* @throws RuntimeException
*
* @param string $name The human readable name for this migration.
*
* @return string The filename for the new migration.
*/
public function initializeMigration($name)
{
$version = microtime(true) * 10000;
$migration = new sfPropelMigration($version, $name);
$skeleton = sfPropelMigrationSkeleton::getSkeleton($version);
if (!is_dir($migration->getDirname())) {
$fs = new sfFilesystem();
$fs->mkdirs($migration->getDirname());
}
if (is_writable($migration->getDirname())) {
if (file_put_contents($migration->getFullFilename(), $skeleton) === false) {
throw new RuntimeException(self::EXCEPTION_MIGRATION_NOT_WRITTEN);
}
} else {
throw new RuntimeException(self::EXCEPTION_MIGRATION_DIR_NOT_WRITABLE);
}
return $migration->getFilename();
}
示例12: cacheOutput
public function cacheOutput($event, $content)
{
$cacheBaseDir = $this->rootDir . DIRECTORY_SEPARATOR . 'cache';
$cacheRoutes = array('plugin_rest_release_deps', 'plugin_rest_package_info', 'plugin_rest_release_version');
$lastEntry = sfContext::getInstance()->getActionStack()->getLastEntry();
if (!$lastEntry) {
return $content;
}
$lastRouting = $lastEntry->getActionInstance()->getContext()->getRouting();
$lastRequest = $lastEntry->getActionInstance()->getRequest();
$currentRouteName = $lastRouting->getCurrentRouteName();
$filePath = $cacheBaseDir . $lastRequest->getPathInfo();
// TODO: Add consider to Windows directory separator
if (in_array($currentRouteName, $cacheRoutes)) {
$filesystem = new sfFilesystem();
$filesystem->mkdirs(dirname($filePath));
file_put_contents($filePath, $content);
}
return $content;
}
开发者ID:balibali,项目名称:opPluginChannelServerPlugin,代码行数:20,代码来源:opPluginChannelServerPluginConfiguration.class.php
示例13: setCacheDir
public function setCacheDir($cacheDir)
{
$newCacheDir = $cacheDir . DIRECTORY_SEPARATOR;
if (is_callable('posix_getuid')) {
$userinfo = posix_getpwuid(posix_getuid());
$newCacheDir .= $userinfo['name'];
} else {
$newCacheDir .= php_sapi_name();
}
sfConfig::set('sf_cache_dir', $newCacheDir);
if (is_dir($newCacheDir)) {
$filesystem = new sfFilesystem();
$filesystem->mkdirs($newCacheDir);
$filesystem->chmod($newCacheDir, 0777);
}
parent::setCacheDir($newCacheDir);
}
示例14: dirname
<?php
/**
* @author Julien Muetton
* @see http://www.symfony-project.org/blog/2009/06/10/new-in-symfony-1-3-project-creation-customization
*/
$fs = new sfFilesystem();
$fs->mkdirs(sfConfig::get('sf_plugins_dir') . '/sfPropelORMPlugin');
$root_dir = realpath(sfConfig::get('sf_root_dir') . '/../');
$plugin_dir = realpath(sfConfig::get('sf_plugins_dir') . '/sfPropelORMPlugin');
$finder = sfFinder::type('any')->ignore_version_control(false)->discard('mockproject')->prune('mockproject');
$fs->mirror($root_dir, $plugin_dir, $finder);
$fs->execute(sprintf('cd %s && git submodule update --init --recursive', $plugin_dir));
include dirname(__FILE__) . '/../../config/installer.php';
$fs->mkdirs($task_dir = sfConfig::get('sf_lib_dir') . '/task');
$fs->copy(dirname(__FILE__) . '/PropelInstallTask.class.php', $task_dir . '/PropelInstallTask.class.php');
$this->runTask('cache:clear');
示例15: setCacheDir
public function setCacheDir($cacheDir)
{
$newCacheDir = $cacheDir . DIRECTORY_SEPARATOR . php_sapi_name();
sfConfig::set('sf_cache_dir', $newCacheDir);
$filesystem = new sfFilesystem();
$filesystem->mkdirs(sfConfig::get('sf_cache_dir'));
parent::setCacheDir($newCacheDir);
}