Simple CLI call to core_course_category::get() returns null

Simple CLI call to core_course_category::get() returns null

by עומר המאירי -
Number of replies: 1

Wrote this:


<?php

define('CLI_SCRIPT', true);

require(_DIR_.'/../../config.php');
require_once($CFG->dirroot.'/course/lib.php');

$catid = 100;
$cat = core_course_category::get($catid);



when CLI running it - $cat is not initialized and remains null.


HELP ?

thanks..

Average of ratings: -
In reply to עומר המאירי

Re: Simple CLI call to core_course_category::get() returns null

by Dominique Palumbo -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi,

the only mistake you do and I suppose you already find it.
It's the _DIR_ variable name it's __DIR__ four underscores not two.

require(__DIR__.'/../../config.php');

Dominique.