mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #11900
[Bug 1111066] Re: define('CLI') should bypass auth_setup() in init.php
** Changed in: mahara
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contrib members
https://bugs.launchpad.net/bugs/1111066
Title:
define('CLI') should bypass auth_setup() in init.php
Status in Mahara ePortfolio:
Fix Released
Bug description:
If you create a command-line script as described on
https://wiki.mahara.org/index.php/Developer_Area/CLI_Framework ,
putting define('CLI'); and define('INTERNAL'); at the top, it will
error out every time in init.php because auth_setup() detects that you
haven't logged in.
I think this has gone unnoticed because the two existing CLI scripts
in Mahara core both also use define('INSTALLER'), and if that's
defined then init.php doesn't check auth_setup(). I propose that
define('CLI') should also bypass auth_setup() in init.php
Sample script to demonstrate this problem:
<?php
define('CLI', 1);
define('INTERNAL', 1);
define('ADMIN', 1);
require(dirname(__FILE__).'/init.php');
require(get_config('libroot').'cli.php');
cli::cli_exit('Hello');
Expected Result: When executed via the command-line, it should print "Hello" and quit
Actual Result: It prints a terminal full of the HTML for the Mahara login page and dies.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1111066/+subscriptions
References