PHP Method Yii::getFrameworkPath Code Examples

This page contains top rated real world PHP examples of method Yii::getFrameworkPath extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: MigrationTool.php Project: aakbar24/CollegeCorner_Ver_2.0
0
 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);
 }
Example #2
Show file File: EIronWorkersCommand.php Project: br0sk/yiiron
0
 /**
  * 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";
 }
Example #3
Show file File: helpers.php Project: uiDeveloper116/webstore
0
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);
}
Example #4
Show file File: ProfileController.php Project: erick305/testing
0
 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");
 }