Yiic Command Results In Class Not Found

I created a file in protected/commands called DeactivateCommand.php thus


class DeactivateCommand extends CConsoleCommand {


public function run( $args ){

        User::deactivate_nonrecent();

}


}

When I tried to run the command, the result was (note how it dumps the contents of the class file onto STDOUT before printing the trace)


jeff@myhost:/var/www-virtual/myapp/protected$ ./yiic deactivate

class DeactivateCommand extends CConsoleCommand {


public function run( $args ){

        User::deactivate_nonrecent();

}


}

PHP Error[2]: include(deactivateCommand.php): failed to open stream: No such file or directory

    in file /var/www-virtual/yii-1.1.12.b600af/framework/YiiBase.php at line 423

#0 /var/www-virtual/yii-1.1.12.b600af/framework/YiiBase.php(423): autoload()

#1 unknown(0): autoload()

#2 /var/www-virtual/yii-1.1.12.b600af/framework/console/CConsoleCommandRunner.php(135): spl_autoload_call()

#3 /var/www-virtual/yii-1.1.12.b600af/framework/console/CConsoleCommandRunner.php(65): CConsoleCommandRunner->createCommand()

#4 /var/www-virtual/yii-1.1.12.b600af/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()

#5 /var/www-virtual/yii-1.1.12.b600af/framework/base/CApplication.php(162): CConsoleApplication->processRequest()

#6 /var/www-virtual/yii-1.1.12.b600af/framework/yiic.php(34): CConsoleApplication->run()

#7 /var/www-virtual/myapp/protected/yiic.php(7): require_once()

#8 /var/www-virtual/myapp/protected/yiic(4): require_once()

When I copied main.php to console.php and added ‘application.commands.*’ to ‘import’ the new result is (note how it now dumps the contents of the class file twice)


jeff@myhost:/var/www-virtual/myapp/protected$ ./yiic deactivate

class DeactivateCommand extends CConsoleCommand {


public function run( $args ){

        User::deactivate_nonrecent();

}


}

class DeactivateCommand extends CConsoleCommand {


public function run( $args ){

        User::deactivate_nonrecent();

}


}

PHP Fatal error:  Class 'DeactivateCommand' not found in /var/www-virtual/yii-1.1.12.b600af/framework/console/CConsoleCommandRunner.php on line 135

Is … is it possible that file doesn’t start off with [font=“Courier New”]<?php[/font] ?

:blink:

GAAAA!!!!!!

Now if it always were this simple. Thanks for the +rep ;)