Page 1 of 3

Cron

Posted: Mon Jul 14, 2014 10:19 am
by david63
Is Cron working in 3.1.0 RC2?

I know that it was working in B3 but I don't know if there is now a bug, my test set-up configuration or I have missed some option somewhere.

Re: Cron

Posted: Fri Jul 18, 2014 7:32 pm
by Dr.Death
I second that....on RC1/RC2 my cron is also not working anymore...nothing changed on my extension cronfiles so far...

EDIT:

Maybe some of the DEV Team could answer our question?

This (private) extensions is working with RC2, except the cron task which was working till Beta-4.

https://github.com/DrDeath/phpbb-ext-f1webtip

It seems, that the cron framework is not executing the new cron Extension defined in the services.yml

Code: Select all

     cron.task.core.email_reminder:
        class: drdeath\f1webtip\cron\task\core\email_reminder
        arguments:
            - @config
            - @controller.helper
            - @template
            - @user
        calls:
            - [set_name, [cron.task.core.email_reminder]]
        tags:
            - { name: cron.task }
Maybe something was changed on the cron framwork between Beta-4 and RC1/RC2 and I'm not able to find this.....

Re: Cron

Posted: Sat Jul 19, 2014 11:00 am
by Dr.Death
Update:

If I run the cron.php with the cron_type parameter "cron.task.core.email_reminder" it works in RC2:

http://localhost/phpbb31/cron.php?cron_type=cron.task.core.email_reminder

So the cron task itself is ok, but the framework of RC1/RC2 is not able to provide or detect the service.


Could someone provide a correct or an uptodate service.yml to extend the phpbb core cron system?

Re: Cron

Posted: Sat Jul 19, 2014 12:00 pm
by david63
I am not even convinced that the "basic" cron is running and/or being triggered.

As a test I set up a vanilla RC2 board - no extension no changes. I created a new forum category in which I created a new forum with auto pruning options set as low as possible (1 day) over a couple of days I made a few posts in this forum and non of them have been pruned despite the fact that I have not visited that particular forum.

I think that the main problem is being able to test cron on a small test forum - the best that I have been able to come up with is to put some add_log commands into the various cron files but non of them have been triggered.

Re: Cron

Posted: Sat Jul 19, 2014 12:48 pm
by nicofuma
What is the result of the following commands?

Code: Select all

phpBB/bin/phpbbcli.php cron:list
phpBB/bin/phpbbcli.php config:get cron_lock

Re: Cron

Posted: Sat Jul 19, 2014 12:52 pm
by david63
nicofuma wrote:What is the result of the following commands?

Code: Select all

phpBB/bin/phpbbcli.php cron:list
phpBB/bin/phpbbcli.php config:get cron_lock
I am getting respectively

Code: Select all

No route found for "GET /phpBB/bin/phpbbcli.php%20cron:list"
No route found for "GET /phpBB/bin/phpbbcli.php%20config:get%20cron_lock"

Re: Cron

Posted: Sat Jul 19, 2014 12:59 pm
by nicofuma
heu... you have to use the cli phpBB/bin/phpbbcli.php is the path to the script

Re: Cron

Posted: Sat Jul 19, 2014 2:15 pm
by david63
nicofuma wrote:heu... you have to use the cli phpBB/bin/phpbbcli.php is the path to the script
Sorry but I don't know what you mean

Re: Cron

Posted: Sat Jul 19, 2014 2:18 pm
by nicofuma
https://blog.phpbb.com/2013/11/13/comma ... interface/ and the corresponding script is phpbbcli.php (located in bin/)

Re: Cron

Posted: Sat Jul 19, 2014 2:55 pm
by david63
Sorry but I do not have shell access

Re: Cron

Posted: Sat Jul 19, 2014 3:24 pm
by Dr.Death
Hi,

thanks for your help!

I receive this output in my Terminal:

Code: Select all

in /Applications/XAMPP/htdocs/phpbb31
./bin/phpbbcli.php cron:list
TASKS_READY
cron.task.core.tidy_database

TASKS_NOT_READY
cron.task.core.prune_all_forums
cron.task.core.prune_forum
cron.task.core.prune_shadow_topics
cron.task.core.prune_notifications
cron.task.core.queue
cron.task.core.tidy_cache
cron.task.core.tidy_plupload
cron.task.core.tidy_search
cron.task.core.tidy_sessions
cron.task.core.tidy_warnings

Code: Select all

in /Applications/XAMPP/htdocs/phpbb31
 ./bin/phpbbcli.php config:get cron_lock
0

Starting a cron task via cli shows no error messages:

Code: Select all

 ./bin/phpbbcli.php cron:run cron.task.core.tidy_cache 
But trying to start the new cron task (extended by my extension) like this:
./bin/phpbbcli.php cron:run cron.task.core.email_reminder
I receive this error message:
CRON_NO_SUCH_TASK

So, the cron framework is not aware of the new cron task from the extension provided by the Extension services.yml.

...but it has been worked before RC1(or RC2)

Re: Cron

Posted: Sat Jul 19, 2014 3:30 pm
by nicofuma
You need the latest dev. version to be able to use in the cli a service added by an extension.

Re: Cron

Posted: Sat Jul 19, 2014 3:50 pm
by Dr.Death
Thanks!

Now the cron task was found on the cli .... I'll test it a little bit more and give you further feedback.....

Re: Cron

Posted: Sat Jul 19, 2014 5:20 pm
by Dr.Death
ok,

sorry for bumping, but here some news:

Installed a complete fresh DEV phpBB 3.1 with a clean database.
Installed my Extension and enabled it.

Command line commands so far:

Resetting the cron-lock:

Code: Select all

./bin/phpbbcli.php config:set cron_lock 0
Successfully set config cron_lock
listing the existing cron tasks:

Code: Select all

./bin/phpbbcli.php cron:list
Ready tasks:
cron.task.core.email_reminder

Not ready tasks:
cron.task.core.prune_all_forums
cron.task.core.prune_forum
cron.task.core.prune_shadow_topics
cron.task.core.prune_notifications
cron.task.core.queue
cron.task.core.tidy_cache
cron.task.core.tidy_database
cron.task.core.tidy_plupload
cron.task.core.tidy_search
cron.task.core.tidy_sessions
cron.task.core.tidy_warnings
The cron task "cron.task.core.email_reminder" is now ready to start....

Code: Select all

./bin/phpbbcli.php cron:run cron.task.core.email_reminder
 
Fatal error: SQL ERROR [ mysqli ]<br /><br />You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [1064]<br /><br />An SQL error occurred while fetching this page. Please contact the <a href="mailto:dr.death@xxxx.de">Board Administrator</a> if this problem persists. in /Applications/XAMPP/xamppfiles/htdocs/phpBB/phpbb/db/driver/driver.php on line 844
An echo of the malformed $sql statement:

Code: Select all

SELECT *
			FROM phpbb_styles s
			WHERE s.style_id =
huuuu..... I've never created some kind of this sql statements in my Extension ...... :roll:

The cron task itself was running succesfully...... *weird*

Re: Cron

Posted: Sat Jul 19, 2014 6:32 pm
by nicofuma
It's unrelated but you shouldn't name you service 'cron.task.core.email_reminder' it's not a cron task defined by the core^^

For the SQL error, it's because of the call $user->setup(). Anyway, with the cli (with the cron you can have an other user we because we can't know which one you should assume that it's ANONYMOUS), the user is always ANONYMOUS.
By the way, you should avoid the globals as possible they are deprecated (destined to disappear) and are kept only for compatibility with some legacy functions.