Yii Framework Forum: Issues With New Command Line - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Issues With New Command Line New commands not being recognized Rate Topic: -----

#1 User is offline   nsp37 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-December 12

Posted 20 December 2012 - 11:18 AM

I recently inherited a Yii application and have been figuring it out thus far rather well. I need to create a new command for a console usage for a sort of Cron job and am running into issues getting the command to be recognized. A strange side symptom seems to be that even old commands that I edit are not changing their output (i.e. the sample command was changed to echo 'This is a NEW sample' and still echos 'This is a sample').

All files are located in protected/commands/

My class is as follows:
QueueTumblrProcessCommand.php
<?php

class QueueTumblrProcessCommand extends CConsoleCommand {
    
	public function run($args) {

		Yii::app()->whims_queue_tumblr_process->main();

	} // End of run()


} // End of QueueTumblrProcessCommand class




The config is as follows:
<?php
/**
* Our configuration file when running stuff from the command line.
*/

//      
// Set our include path to a local version of PEAR
//              
set_include_path(__DIR__ . '/../../../../../pear/php' . PATH_SEPARATOR
	. get_include_path());

//
// Require the PEAR class since PEAR_Error is in the same file. 
// (Yes, I think that was a bad idea from PEAR...)
//
require_once("PEAR.php");

//
// Set our default timezone.
//
date_default_timezone_set('America/New_York'); 

$_config = array(

	//
	// This is basically the "APP_NAME/protected/" directory.
	//
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'My Console Application',

	//
	// Autoload all model and component classes.
	//
	'import'=>array(
		'application.models.*',
		'application.components.*',
		//
		// Load classes from Amazon Web Services
		//
		'application.vendors.amazon.*',
	),

    'commandMap'=>array(
            'queuetumblrprocess'=>array(
            'class'=>'QueueTumblrProcess',
                ),
                                     
    ),

);


//
// Load our components
//
$_config["components"] = include_once("components/main.php");
unset($_retval_components);

$_config["params"] = include_once("params.inc.php");
unset($_config_params);

$_config["components"]["db"] = include_once("db.inc.php");
unset($_config_db);
unset($_config_fb_file);
unset($_current_dir);

//print_r($_config); // Debugging

return($_config);


my CLI script is as follows:
#!/usr/bin/env php
<?php
defined('YII_DEBUG') or define('YII_DEBUG',true);
 
//
// Load Yii
//
require_once(dirname(__FILE__) . '/../yii/current/framework/yii.php');

//
// Load our console config file
//
$configFile = dirname(__FILE__) . "/../protected/config/console.php";

echo $configFile;
 
//
// Now run the console application.
//
Yii::createConsoleApplication($configFile)->run();


The command map was my attempt to force the loading of the new command, though still did not work.

I am trying to figure out if there is some sort of cache system I am missing out on that is keeping these commands loaded? Or am I missing other things in the process.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users