HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[SOLVED] Quiz & cron_bridge.php

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#50490 (In Topic #11006)
Avatar

Community saint

Could you please enlighten me on the following difficulties?

Quiz & cron_bridge.php

Could you please enlighten me on the following difficulties?

I've created a small quiz with a 15 minutes time limit and 48 hours resubmit prevention.

Everything went well and aside from not finding instructions on how to publish it, I managed to include it on a content side-menu. It works marvelously well and I was surprised with a well thought off, after completion E-mail.

Now for the parts that don't seem to work:

1-The following error message appears when I run it:
An error occurred when loading this screen onto the web browser. You are being notified of this as you are staff. If you believe this is a bug in the website software, please contact ocProducts with full details. More details are available in your browser's error console. The error was: (I changed "mysite" being the location on my server

Code

1183: missing variable name http://mysite/site/pg/quiz/do/1
2-The quiz timers do not work.
After reading the ocPortal documentation, I figured out that I needed to install some kind of Cronjob.
My Linux hosting Server's cPanel has a "Cron Job" feature to enable this. So, I've setup an "every minute" job with the suggested php code:

Code

php /myhome/data/cron_bridge.php
(myhome being my home directory on the server)

This had for effect a multitude of error emails every minute with the following message:
Status: 404

X-Powered-By: PHP/4.4.9

Content-type: text/html

A search of the php documentation just added frustration to the confusion and a search on ocPortal did not raised anything. I cannot imagine that I could be the only one with such problems, and if so, I must have missed an important part of the documentation.
Thank you for your help.


Last edit: by Jean
Back to the top
 
Posted
Rating:
#50491
Avatar

Hi,

It sounds like we have a hole in our documentation, and you've found a bug (likely the JS error causes the timer to stop working).

CRON is unrelated to this, but I'm wondering if the path you put in isn't the right one; maybe you gave it an FTP path, rather than a true filesystem path? Thinking about it now maybe we can make this easier and make the system tell you exactly what to put in; I'll give it some thought.

I'll get back to you soon about the bug :).

I read your intro topic, nice to meet you, and what your doing is exciting. As others have said, please ask if you have any problems :). If there is a clear hole in the documentation for a common task, or if there is a bug, we'll usually get back for free quite quickly :). ocPortal is still quite new and still picking up wrt the size of the user-base, and it's a huge system – so it isn't very unusual for little bugs or documentation omissions to come up.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50493
Avatar

Community saint

Nice to meet you Chris!

Thanks for your quick answer, and know that it is much appreciated on Easter Sunday.

I would not have faulted anyone for not having answered immediately this weekend. My own Internet system at home is out of commission since yesterday afternoon, so I had to go to my office downtown to check my mail and do some prep work. I suspect that my ISP's entire staff is on the beach having a barbeQ weekend until Tuesday Morning. Maybe I should join them!

You are right; I have used the FTP path, not knowing, rather than the URL path to the filesystem. I'll test this out when my Internet is back and confirme the result here.

For the potential Bug, I look at it this way; if it truly is one, I have contributed something by reporting it.

Thanks for your kind words of encouragement.:)
Jean
Back to the top
 
Posted
Rating:
#50512
Avatar

Hi,

1) Bug confirmed. A fix is attached (please overwrite your existing file)
Attachment
themes/default/templates/QUIZ_SCREEN.tpl
» Download: QUIZ_SCREEN.tpl (1.18 Kb, 269 downloads so far)


2) Adding this to the docs…
"To add your quiz to a menu, use the Site Tree tool within the menu editor. You will find your quiz is available as a link underneath the Site\Quiz module."
This is a technique you can use quite often – the menu can find almost anything on the site for easy placement onto a menu item.

3) Not relevant to you now, but for the next patch release ocPortal will have a new little feature to work out the CRON command for you.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50531
Avatar

Community saint

Chris,

Thank you for this bug fix!

The quiz timer is now working perfectly without the previous error message.

However, after clicking the "proceed" button at the end of the test, but well within the time limit, I receive the following error:
"An error has occurred You spent too long answering this."

I believe that this is because I still do not have a handle on the Cron Job, which keeps sending me error emails minute by minute on every possible combination of a command line I could think of. I am also thinking that the overtime error could be because of the time zone difference of 3 hours between the server and my computer. When the test is completed, is it that my time is actually 3 hours ahead of the server's timer?

This is not critically urgent, so there is no need to rush, but it is intriguing.

Your efforts and time with this is much appreaciated
Thank you!
Back to the top
 
Posted
Rating:
#50570
Avatar

I think this will solve your problem:
Attachment
site/pages/modules/quiz.php
» Download: quiz.php (24 Kb, 251 downloads so far)


The quiz was using the time you first started the quiz rather than the time you last started it. The attached improves this behaviour a bit w.r.t. repeating the quiz (as opposed to just reloading it), and shows the correct time on the timer.

Cron definitely isn't related to the quizzes. However if you're still trying to find the Cron path, it might help to look in the PHP info (under Tools in the Admin Zone). There might be an entry something like 'SCRIPT_FILENAME' which gives a good impression of what the filesystem paths are like.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50590
Avatar

Community saint

Thanks for the last Quiz Update.
It is now functioning perfectly!
:thumbs:


Your suggestion for the cron job seems to be paying off. I was close, but missing an element. Now my new trial was done with the following code (user changed):

Code

php /home/user/public_html/oc/data/cron_bridge.php

I received an immediate email with the following message:

Code

/bin/sh: /home/user/public_html/oc/data/cron_bridge.php: Permission denied

A few seconds later this one came in followed by a new one every minute until disabled.

Code

Expires: Mon, 20 Dec 1998 01:00:00 GMT
Last-Modified: Tue, 14 Apr 2009 17:42:01 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
X-Powered-By: ocPortal 4.1.9 (PHP 4.4.9)
Set-Cookie: has_cookies=1; expires=Wed, 12 Aug 2009 17:42:01 GMT; path=/;
domain=mydomain.oc.a.com
Set-Cookie: ocp_session=1788437408; expires=Tue, 14 Apr 2009 22:42:01 GMT;
path=/
Content-type: text/html; charset=ISO-8859-1

I think that we are getting somewhere, and cookies are being set by the site, but somehow a cache need to exist or flushed…
Or, is it my old Host acting badly?

Later today, I'm starting my experiment with the first group of students and we should have about 15 new sites by tonight.
The new Host for this experiment is Elief's small business option and I'll try using their "cron job" and see what happens. I just got back my Internet after spending hours calling and waiting in line at the telephone company this morning.:cool:
Back to the top
 
Posted
Rating:
#50611
Avatar

Glad it's now working :).

I had a quick look at the PHP manual (PHP: Using PHP from the command line - Manual), and I think one of these variants may fix your CRON problem…

Code

php-cli /home/user/public_html/oc/data/cron_bridge.php

Code

php -C /home/user/public_html/oc/data/cron_bridge.php

Code

php -q --no-header /home/user/public_html/oc/data/cron_bridge.php

I'm not sure exactly as I believe different PHP packages deploy different sets of commands, and different PHP versions support different options and behaviour.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50625
Avatar

Community saint

Once again, thank you Chris for your help in finding the correct solution.

Code

 php-cli /home/user/public_html/oc/data/cron_bridge.php

That one turned out to be the correct command syntax.

It produced no confirmation or denial email, but a test in subscribing to a timed calendar event returned the proper notification email at the precised time. Therefore, I guess it makes the process valid.

Last night, a first group of students participating in our project, successfully deployed 16 ocPortal sites from an Elief hosted Domain, using the cPanel Installation wizard. After installation, 16 computers hooked on one (<1mbps ) DSL shared line, simultaneously logged to their individual sites and ran the Setup Wizard and the configuration option categories without a single glitch. I think that this is a good testimonial for the stability of the Host, but even more so to the impeccable coding of the ocPortal software. We will be adding 18 more on Thursday evening and 28 on Monday. This project will establish a test base to evaluate the potential of each site and give an opportunity to the students, at the end of the course, to move their sites to their own Hosted Domains.

Thanks for the opportunities your work is giving to a group of workers in search of creative ideas in a difficult world economy.:thumbs:
Back to the top
 
Posted
Rating:
#50635
Avatar

Community saint

I Forgot to mention that the CRON item on the check list in the admin zone is now gone.
This check list is really doing its job!:)
Back to the top
 
Posted
Rating:
#50747
Avatar

Community saint

Sorry to have to reopen this topic, but I've discovered another glitch to the Quiz system:

When a user starts a Quiz, but leaves it before the timer reached the end, the timer continues indefinitely to eventually show negative numbers when taking the same test again, or any subsequent tests, resulting in a timeout error.

This would also include someone accidentally clicking on the quiz-Menu Item and moving on to another link.

By pressing on the "proceed" button, the timer will stop, but the test cannot be repeated until the end of the recursive period.

Thank you for looking into this matter.  It is not urgent, just a minor irritant in an otherwise great educational tool for students members.
Back to the top
 
Posted
Rating:
#50750
Avatar

Hi,

It's intentional that the timer does not reset on the same quiz – to stop people cheating by refreshing the page.

Unfortunately though the timer doesn't track individual quizzes. That's an oversight on our part but we can't fix it without changing the database structure, so it will need to wait a while.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50753
Avatar

Community saint

Chris Graham said

Hi,

It's intentional that the timer does not reset on the same quiz - to stop people cheating by refreshing the page.

Unfortunately though the timer doesn't track individual quizzes. That's an oversight on our part but we can't fix it without changing the database structure, so it will need to wait a while.

Thanks for this explanation Chris!
I will just add a warning and a rule-set to read before taking the test.

Happy to wait for the next edition.
The advantages of having these 3 different quiz types far outweigh this glitch, and I just hope that the feature will continue to get richer in future versions.

Thanks again!
Jean
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: