MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Bugs and Requests => Topic started by: Spacedust on 2015-06-09, 18:47:45

Title: [CRITICAL] Editing advanced cron reset all values to 0
Post by: Spacedust on 2015-06-09, 18:47:45
Editing advanced cron reset all values to 0 even when they are different.
Title: Re: Customer was able not to choose a minute in cron !
Post by: MRatWork on 2015-06-09, 18:55:10
Did you select 'Enable Cron For All Users' in 'General Settings'?.
Title: Re: Customer was able not to choose a minute in cron !
Post by: Spacedust on 2015-06-09, 19:00:42
Did you select 'Enable Cron For All Users' in 'General Settings'?.

Yes. Just a correction:

Customer is able to add cron with minutes etc. but only first entry is actually added to the server.

If you try to edit cron entry then it shows "Field cannot be empty" and removes cron minute from the list so for example instead showing 0 it shows "-" instead.

I'm testing latest Kloxo-MR now. Maybe there was some troubles with translation.
Title: Re: Customer was able not to choose a minute in cron !
Post by: Spacedust on 2015-06-09, 19:11:52
See cronjob logs:

18:11 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_ldusav3bHRg":2: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'ldusa' '/home/tmp/lxtmp__var_spool_cron_ldusav3bHRg']
18:13 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_ldusaNxM5Af":2: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'ldusa' '/home/tmp/lxtmp__var_spool_cron_ldusaNxM5Af']
Title: Re: Customer was able not to choose a minute in cron !
Post by: Spacedust on 2015-06-09, 19:48:26
It happens always if I add more than one cron job entry on all customers !
Title: Re: Adding more than one cron job does not work
Post by: Spacedust on 2015-06-09, 20:05:25
Just tested my very old Kloxo-MR installation Kloxo-MR 7.0.0.b-2015050301 and this bug persists.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 20:18:27
It works fine in Kloxo-MR 7.0.0.b-2015041302
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 20:32:41
Using the same phpXYs?.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 20:39:43
Using the same phpXYs?.

Yes. Always php54s. Restored old cronlib.php and it works fine on production server too. I needed to readd all cron entries from last month !
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 20:45:21
Open '/usr/local/lxlabs/kloxo/httpdocs/driver/pserver/cronlib.php' and change:

from:
Code: [Select]
function postAdd()
{
// We need to write because reads everything from the database.
$this->write();

if (!$this->isSimple()) {
$this->checkIfNull();
$this->convertAll();
}
}

to:
Code: [Select]
function postAdd()
{
if (!$this->isSimple()) {
$this->checkIfNull();
$this->convertAll();
}

// We need to write because reads everything from the database.
$this->write();
}
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 20:51:41
It works, but trying to fix wrongly added entries always shows 0 in complex cron Minute:

"Field cannot be blank"

then on the list a proper minute is replaced by -

Is there anyway to fix these entires without readding them ?
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 21:03:52
Still some errors when adding new entires but not always. Please investigate !

Example adding something like this:

    sjk2014    http://newsfakt.pl/cron-10min.php    localhost    complex    39    --all--    --all--    --all--    --all--

Then trying to edit and saving does not work properly.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:04:53
Try add '/usr/local/lxlabs/kloxo/pscript/fixcron' with content:
Code: [Select]
#!/bin/sh

. /script/directory
lxphp.exe ../bin/cronfix.php $*
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:06:34
Still some errors when adding new entires but not always. Please investigate !

Example adding something like this:

    sjk2014    http://newsfakt.pl/cron-10min.php    localhost    complex    39    --all--    --all--    --all--    --all--

Then trying to edit and saving does not work properly.

So, try change to:
Code: [Select]
function postAdd()
{
if (!$this->isSimple()) {
$this->checkIfNull();
$this->convertAll();
}

// We need to write because reads everything from the database.
//$this->write();
}
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:09:20
Also change to '//   $this->write();' for 'function postUpdate()'
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 21:11:52
Does not help - instead of my minute 37 it shows 0 in minute.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:14:14
Add will be execute postAdd() and update will be execute postUpdate().
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 21:16:26
Both postAdd() and postUpdate() have $this->write(); disabled and nothing.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:19:15
Comparing content of cronlib.php between Kloxo-MR 7.0.0.b-2015041302 and latest update.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-06-09, 21:36:51
I didn't found this issue in latest update.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 22:25:06
Adding/removing works fine. Editing does not !
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 22:26:23
Please check my cronlib.php

http://tnij.org/uv6mtnx
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 22:36:29
Still the same, for some customers even when adding:

21:37 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_rochstar79lFpKba":4: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'rochstar79' '/home/tmp/lxtmp__var_spool_cron_rochstar79lFpKba']
21:37 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_rochstar794tzkyz":4: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'rochstar79' '/home/tmp/lxtmp__var_spool_cron_rochstar794tzkyz']
21:37 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_rochstar796xgCZY":4: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'rochstar79' '/home/tmp/lxtmp__var_spool_cron_rochstar796xgCZY']
21:38 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_rochstar79GVofwo":4: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'rochstar79' '/home/tmp/lxtmp__var_spool_cron_rochstar79GVofwo']
21:39 Jun/09/2015: 1: "/home/tmp/lxtmp__var_spool_cron_rochstar79W6ozqI":4: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'rochstar79' '/home/tmp/lxtmp__var_spool_cron_rochstar79W6ozqI']
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 22:57:26
$this->write(); for PostAdd is a must

Now testing PostUpdate is different place.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 23:07:42
Adding/removing works.

When trying to edit all minutes/hours which were selected are changed to 0 and nothing is changed.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 23:27:33
Just tested my old Kloxo-MR 7.0.0.b-2015041302 - it also has troubles with editing cron jobs.

I'm testing even older one.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 23:43:42
Very old version Kloxo-MR 7.0.0.b-2015011402 also the same - 0's when editing cron jobs instead of proper minutes.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-09, 23:53:21
Even Kloxo-MR 7.0.0.b-2014120802 has it too ;(

22:57 Jun/09/2015: 1: "/tmp/lxtmp__var_spool_cron_admin2QDLMY":2: bad hourerrors in crontab file, can't install. [(__system__) 'crontab'  '-u' 'admin' '/tmp/lxtmp__var_spool_cron_admin2QDLMY']

Error Box - Press Esc to close
×
Alert: Adding crontab has failed due to . Please delete this cron and add it again.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 00:07:24
Kloxo-MR 7.0.0.b-2014082703 the same - this is the first 7.0.0 beta version I got.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 00:16:37
Kloxo-MR 6.5.1.b-2014063001 -  the same - wow this bug is so old !
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 00:25:59
Bingo ! Kloxo-MR 6.5.1.b-2014041003 works fine :)

Here comes the file: http://tnij.org/7yk3ykq
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 12:25:01
There is a bug somewhere here:

Quote
   static function convertBackCronList($list, $staticlist)
   {
      if (is_string($list)) {
         $list = array($list);
      }

      foreach ($list as $k => $v) {
         if ($v === '--all--') {
         return $list;
      }


         if ($staticlist) {
            $outl[] = $staticlist[$k];
         } else {
            $outl[] = $k;
         }
      }
      
      return $outl;
   }

Restoring this showed proper values when editing but they are not saved to cron (it also removes all fields in editor) however on cron list they are properly edited, must be something else too:

Quote
   static function convertBackCronList($list, $staticlist)
   {
      if ($list[0] === '--all--') {
         return $list;
      }

      foreach ($list as $l) {
         if ($staticlist) {
            $outl[] = $staticlist[$l];
         } else {
            $outl[] = $l;
         }
      }
      

      return $outl;
   }
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 13:09:27
Mustafa any ideas ?
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 13:19:59
It all started when you fixed security bug: https://github.com/mustafaramadhan/kloxo/commit/71d145fcfee7dad378e1c34f26ad8f65e2768f53 editing cron jobs causes all values to be 0
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-10, 14:19:48
OK - my latest code almost works well. Please note it was translated to Polish, because you still didn't add this to our translation file.

Also static $__desc_weekday = array("", "", "day_of_week"); is a correct form not "Week" which does not exists on our translation file as well.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-11, 13:01:02
Still not working well in latest upload.

Please see:

Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-06-18, 20:56:58
Just tested 7.0.0.b-2015061802 and still doesn't work all values other than 0 are changed to 0 when editing...
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-07-04, 13:49:27
Is it fixed ?
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: MRatWork on 2015-07-04, 14:11:24
Only update still unfixed. But, no issue for add cron.
Title: Re: [CRITICAL] Adding more than one cron job in panel is not added to crontab !
Post by: Spacedust on 2015-07-04, 19:35:56
Only update still unfixed. But, no issue for add cron.

I do not mean adding. I mean editing - all values are reset to 0 !
Title: Re: [CRITICAL] Editing advanced cron reset all values to 0
Post by: MRatWork on 2015-07-04, 22:17:54
So, at this moment, delete the old ones and then add the new one.
Title: Re: [CRITICAL] Editing advanced cron reset all values to 0
Post by: Spacedust on 2015-07-05, 00:18:49
So, at this moment, delete the old ones and then add the new one.

My code is working fine even when editing ;)