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


PHP Yii::getFrameworkPath方法代码示例

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


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

示例1: runMigration

 public static function runMigration($type = null)
 {
     $entryScript = 'yiic';
     $command = 'migrate';
     $interactive = '--interactive=0';
     $commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'commands';
     $runner = new CConsoleCommandRunner();
     $runner->addCommands($commandPath);
     $commandPath = Yii::getFrameworkPath() . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'commands';
     $runner->addCommands($commandPath);
     $args = array($entryScript, $command);
     if ($type !== null) {
         $args[] = $type;
     }
     $args[] = $interactive;
     ob_start();
     $runner->run($args);
     $return = htmlentities(ob_get_clean(), null, Yii::app()->charset);
     Yii::app()->user->setFlash('results', $return);
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:20,代码来源:MigrationTool.php

示例2: actionUploadIronWorker

 /**
  * Run this action like this: yiic myAction uploadIronWorker
  *
  * This command can be integrated to your deployment system. When you have committed your code you can
  * run this command to deploy the code to the iron.io servers.
  *
  * This command zips all the code needed to be uploaded to the Iron Workers
  * Upload the zipped file to Iron Workers. This will create a new version of the code for the current project
  *
  * It will also create a task in the iron.io hud named after the command file. All the actions in this command file
  * will run  as this task on iron.io.
  *
  * It prepares all the files in the runtoime directory and cleans up when finished.
  * TODO: Test in Windows environment
  */
 public function actionUploadIronWorker()
 {
     /**
      * The EYiiron class instance. It is our gateway to all iron.io services
      * @var EYiiron $yiiron
      */
     $yiiron = Yii::app()->yiiron;
     //This is where we store the files before deploying them on iron.io
     $tmpDir = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'ironworkers' . DIRECTORY_SEPARATOR;
     echo "Using PHP Stack :" . $yiiron->stack . "\n";
     //Clean up in the directory. We do this before we start in case the old code was not fully removed.
     EIronWorkersCommand::deleteDir($tmpDir);
     //Make sure we have a clean environment before preparing the runtime environment for iron.io.
     //THis is crucial so we know that the code we deploy is exactly the same as we run locally.
     if (!file_exists($tmpDir)) {
         echo $tmpDir . " doesn't exist creating it now...\n";
         if (!mkdir($tmpDir)) {
             echo "**Error**: Creation failed. Please check your permissions!\n";
             exit(0);
         }
     } else {
         echo "**Error**: " . $tmpDir . " existed even though we tried to fully remove it.\n" . "It could be a permission problem please remove " . $tmpDir . " manually before running this command again.\n";
         exit(0);
     }
     echo "Copying Yii Framework to tmp dir...\n";
     /**
      * The Framework path
      * @var string $yiiPath
      */
     $yiiPath = Yii::getFrameworkPath() . "/../";
     /**
      * The path of your Yii app. Usually the protected folder
      * @var string $appPath
      */
     $appPath = Yii::app()->getBasePath() . "/";
     echo "Yii path: " . $yiiPath . "\n";
     CFileHelper::copyDirectory($yiiPath, $tmpDir . 'yii');
     echo "Copying app from " . $appPath . " to the tmp dir " . $tmpDir . 'app/' . basename($appPath) . "\n";
     //Exclude as much as we can to get a slim file to upload
     CFileHelper::copyDirectory($appPath, $tmpDir . 'app/' . basename($appPath), Yii::app()->yiiron->workerFileCopyOptions);
     echo "Zipping code to " . $tmpDir . "iron_worker.zip\n";
     IronWorker::zipDirectory($tmpDir, $tmpDir . 'iron_worker.zip', true);
     echo "Uploading the code for the worker " . $this->name . "...\n";
     //This is so we can handle custom extension paths
     $ironWorkerExtensionPath = str_replace($appPath, "app/" . basename($appPath) . "/", Yii::app()->getExtensionPath());
     //Read the config array into an array
     $configFile = json_encode(require $appPath . $yiiron->configFile);
     //Posting the code and the initial php file to execute. This on the Iron Worker platform, not locally
     $res = $yiiron->workerPostCode($ironWorkerExtensionPath . "/yiiron/yiic-yiiron.php", $tmpDir . 'iron_worker.zip', $this->getName(), array('config' => $configFile, 'stack' => $yiiron->stack));
     echo "Finished uploading iron_worker.zip (" . EIronWorkersCommand::format_bytes(filesize($tmpDir . 'iron_worker.zip')) . ")\n";
     //Remove all files
     echo "Remove all temp files...\n";
     //EIronWorkersCommand::deleteDir($tmpDir);
     echo "Done!\n";
     echo "Find the worker here http://hud.iron.io/tq/projects/" . Yii::app()->yiiron->projectId . "/tasks/" . $res->id . "/activity\n";
     echo "Now run your command like this: './yiic " . $this->name . " myAction --ironWorker=true' to execute it as an Iron Worker.\n";
 }
开发者ID:br0sk,项目名称:yiiron,代码行数:72,代码来源:EIronWorkersCommand.php

示例3: _runMigrationTool

function _runMigrationTool($steps = null)
{
    $commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'commands';
    $runner = new CConsoleCommandRunner();
    $runner->addCommands($commandPath);
    $commandPath = Yii::getFrameworkPath() . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'commands';
    $runner->addCommands($commandPath);
    $commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'SingleMigrateCommand';
    $runner->addCommands($commandPath);
    if (is_null($steps)) {
        $strCommand = 'migrate';
    } elseif ($steps == 'set') {
        $strCommand = 'setmigrate';
    } elseif ($steps == 'upgrade') {
        $strCommand = 'upgrademigrate';
    } else {
        $strCommand = 'singlemigrate';
    }
    Yii::log("Migrating with {$strCommand}", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
    $args = array('yiic', $strCommand, '--interactive=0', '--migrationTable=xlsws_migrations');
    ob_start();
    $runner->run($args);
    return htmlentities(ob_get_clean(), null, Yii::app()->charset);
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:24,代码来源:helpers.php

示例4: actionSaveSkills

 public function actionSaveSkills()
 {
     $user = User::getCurrentUser();
     if (!isset($_POST['Skill'])) {
         foreach ($user->studentSkillMaps as $skill) {
             $skill->delete();
         }
         $this->redirect("/JobFair/index.php/profile/view");
         return;
     }
     $skills = $_POST['Skill'];
     //first wipe out the users skills
     foreach ($user->studentSkillMaps as $skill) {
         $skill->delete();
     }
     $i = 1;
     foreach ($skills as $skill) {
         $skillmap = new StudentSkillMap();
         $skillmap->userid = $user->id;
         if (!ctype_digit($skill)) {
             //create a new skill
             $newskill = new Skillset();
             $newskill->name = $skill;
             $newskill->save(false);
             $skillmap->skillid = $newskill->id;
         } else {
             $skillmap->skillid = $skill;
         }
         $skillmap->ordering = $i;
         $skillmap->save(false);
         $i++;
     }
     $commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'commands';
     $runner = new CConsoleCommandRunner();
     $runner->addCommands($commandPath);
     $commandPath = Yii::getFrameworkPath() . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'commands';
     $runner->addCommands($commandPath);
     $args = array('yiic', 'jobmatch', "-u", $user->username, "-e", $user->email);
     ob_start();
     $runner->run($args);
     echo htmlentities(ob_get_clean(), null, Yii::app()->charset);
     $this->redirect("/JobFair/index.php/profile/view");
 }
开发者ID:erick305,项目名称:testing,代码行数:43,代码来源:ProfileController.php


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