Skip to content

Commit

Permalink
Fixed issue : unable to log to file in command
Browse files Browse the repository at this point in the history
Dev: bad directory for runtimePath
  • Loading branch information
Shnoulle committed Dec 13, 2016
1 parent f1f6313 commit f6c991c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions application/commands/console.php
@@ -1,5 +1,5 @@
#!/usr/bin/php
<?php
<?php
/*
* LimeSurvey (tm)
* Copyright (C) 2011 The LimeSurvey Project Team / Carsten Schmitz
Expand All @@ -11,7 +11,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
*
*
* File edited by Sam Mousa for Marcel Minke.
* This loader bypasses the default Yii loader and loads a custom console class instead.
*/
Expand All @@ -28,19 +28,22 @@
require_once(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'yii.php');
// Load configuration.
$sCurrentDir=dirname(__FILE__);
$settings=require (dirname($sCurrentDir).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config-defaults.php');
$config=require (dirname($sCurrentDir).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'internal.php');
$core = dirname($sCurrentDir) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR;
if(isset($config['config'])){
$settings=array_merge($settings,$config['config']);
}
unset ($config['defaultController']);
unset ($config['config']);


$config['runtimePath']=$settings['tempdir'].'/runtime';

// fix for fcgi
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));

defined('YII_DEBUG') or define('YII_DEBUG',true);



if(isset($config))
{
Expand All @@ -49,8 +52,9 @@
define('APPPATH', Yii::app()->getBasePath() . DIRECTORY_SEPARATOR);
$app->commandRunner->addCommands(YII_PATH.'/cli/commands');
$env=@getenv('YII_CONSOLE_COMMANDS');
if(!empty($env))
if(!empty($env)){
$app->commandRunner->addCommands($env);
}
}
$app->run();
?>
?>

6 comments on commit f6c991c

@maziminke
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a similar fix for LS 2.06LTS needed/done?

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have issue in https://github.com/SondagesPro/LS-sendMailCron in 2.06 when i create the plugin. Maybe we have removed the application/log ar application/runtime after ?

Must be controlled/tested

@maziminke
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right, the path details were handled a little differently at LS 2.06.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No app/runtime in 2.6 too ....

But cron event is really awfull ... no config set, no config call from DB, unable to use $this->get function etc ....

@maziminke
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this fix apply to this "exception 'CException' with message 'Application runtime path "/var/www/limesurvey_250_161205/application/runtime " is not valid. Please make sure it is a directory writable by the Web server process.' in /var/www/limesurvey_250_161205/framework/base/CApplication.php:294" error (see http://pastebin.com/dSxeSYQw for more details)?

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.