package drupal5
severity 494208 normal
thanks

It does fail for me. The /drupal5/ directory is eliminated in my site's config.
So, the http://localhost/drupal5/cron.php fallback doesn't work. And before
that, the script failed to detect $base_url in
/etc/drupal/5/sites/default/settings.php
because of the logic of the loop:

---8<---
BASE_URL=""

for site in /etc/drupal/5/sites/* ; do
        for file in $site/baseurl.php $site/settings.php; do
                [ -f "$file" ] && BASE_URL=`grep '^$base_url' $file |
cut -d"'" -f2`
                [ "X$BASE_URL" != "X" ] && break
        done

        if [ "X$BASE_URL" = "X" ] ; then
                BASE_URL='http://localhost/drupal5'
        fi

        curl --silent --compressed --location $BASE_URL/cron.php
done
---8<---

In the first iteration, /etc/drupal/5/sites/all was tried out and failed.
And at the end of the loop, BASE_URL was set to
"http://localhost/drupal5";.

So, in the next round for /etc/drupal/5/default, when the non-existent
/etc/drupal/5/sites/default/baseurl.php is tested, the BASE_URL still
stays unchanged, and the next line just results in a break, before
/etc/drupal/5/sites/default/settings.php has a chance to be tested.

Therefore, the script ends up with 3 useless fetchings for
http://localhost/drupal5/cron.php. So, the periodic updates never
happen to my site.

My workaround before finding this bug entry was to modify the
loop as follows:

---8<---
for site in /etc/drupal/5/sites/* ; do
        BASE_URL=""
        for file in $site/baseurl.php $site/settings.php; do
                [ -f "$file" ] && BASE_URL=`grep '^$base_url' $file |
cut -d"'" -f2`
                if [ "X$BASE_URL" != "X" ] ; then
                        curl --silent --compressed --location $BASE_URL/cron.php
                        break
                fi
        done
done
---8<---

BASE_URL is cleared before trying every site, and no more
localhost fallback on every site. Just once at the end of script is
enough.

However, Nelson's script appears to be cleaner. (The split of FOUND
variable is more correct than just non-null test on BASE_URL, which
is now cleared on every iteration.)

So, I've replaced my workaround with Nelson's cron on my site,
and it works fine.

And, as it does break some functionality for my case, may I raise the
severity to normal?

Regards,
-- 
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to