mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #11833
[Bug 1111066] Re: define('CLI') should bypass auth_setup() in init.php
Was initially pushed as a patch for 1.6:
https://reviews.mahara.org/#/c/2024/
I've abandoned that one and submitted a patch for 1.7 instead:
https://reviews.mahara.org/2066
** Changed in: mahara
Milestone: None => 1.7.0
** Changed in: mahara
Status: New => In Progress
** Changed in: mahara
Importance: Undecided => Low
** Changed in: mahara
Assignee: (unassigned) => Aaron Wells (u-aaronw)
--
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:
In Progress
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