Location: PHPKode > projects > FladsClassifieds > fladsclassifieds-full_091201/docs/PERIODIC_TASKS.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
  <title>FladsClassifieds - Automatic Tasks</title>


  <style type="text/css">
body {
font-family: serif;
font-size: medium;
color: #000000;
margin: 0px;
}
h1 {
font-family: sans-serif;
font-size: large;
margin: 5px 0px;
padding: 40px 0px 0px 0px;
text-align: center;
border-bottom: 2px solid #CCCCCC;
}
h2 {
font-family: sans-serif;
background: #CCCCCC;
font-size: medium;
margin-top: 35px;
padding: 5px;
font-weight: bold;
}
h3, h4 {
font-family: sans-serif;
font-size: medium;
margin: 30px 0px 5px 0px;
padding: 5px 0px;
font-weight: bold;
}
div.page {
padding: 0px 20px;
}
ul {
margin: 0px 2em;
padding: 0px;
}
code {
background: #FFFFCC;
}
  </style>
</head>


<body>
<div style="font: normal small-caps  bold x-large sans-serif; background: #CCCCCC;
padding: 15px; text-align: center"><a name="a0">&nbsp;</a>
Periodic Tasks
</div>

<div class="page">

<h1>Contents</h1>
<ul>
  <li><a href="#a1">Requirements</a></li>
  <li><a href="#a2">FladsClassifieds Periodic Tasks</a></li>
  <li><a href="#a3">Links</a></li>
</ul>

<a name="a1">&nbsp;</a>
<h1>Requirements</h1>
<div style="text-align: right;"><a href="#a0">ToC</a></div>
The FladsClassifieds periodic tasks allow:
<ul>
<li>automatic processing of ads that are beyond expiration date,</li>
<li>sending emails to warn ad poster that their ad is about to expire,</li>
<li>automatic deletion of user accounts that have never been used.</li>
</ul>
<br />
To run those periodic tasks, you must be able to run cron jobs. Check
this with  your hosting provider.
<br />
<br />
Download the "Cron job bootstrapper" from the following url:<br />
<a href="http://codeigniter.com/forums/viewthread/88635/" target="_blank">http://codeigniter.com/forums/viewthread/88635/</a>
<br />
<br />
Follow the instructions given on the page to install and configure the
"Cron job bootstrapper". 
<br />
<br />
Add the cronjobs described in the following chapter in your crontab.

<a name="a2">&nbsp;</a>
<h1>FladsClassifieds Automatic Tasks</h1>
<div style="text-align: right;"><a href="#a0">ToC</a></div>
The FladsClassifieds "controller/method"s you can launch using the cron
job bootstrapper mentionned in the previous paragraph are the following:
<ul>
<li><a href="#a21">Set the state of ads that are beyond expiration date
 to "expired"</a>,</li>
<li><a href="#a22">Delete ads with state = "expired"</a>,</li>
<li><a href="#a23">Determine the number of ads per category</a>,</li>
<li><a href="#a24">Send email alert before ad expires</a>,</li>
<li><a href="#a25">Delete user accounts that have never been used</a>.</li>
</ul>

<a name="a21">&nbsp;</a>
<h2>1. Set the state of ads that are beyond expiration date to "expired"</h2>

<b>Controller/method =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/set_expired</code>
<br /><br />
<b>Parameters =</b><br />
<ul>
<li>language (REQUIRED - lowercase)</li>
<li>number of ads to process (OPTIONAL. Default = 15)</li>
</ul>
<br />
<b>Example =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/set_expired/english/10</code>
<br />
i.e.<br />
<code>cron.php --run=/flads_mnt/set_expired/english/10 [--show-output] [--log-file=logfile]</code>
<br />
This will fetch 10 ads in the English section of the website that are
beyond expiration date and will set the state of those ads to "expired".
<div style="text-align: right;"><a href="#a2">Automatic Tasks List</a></div>

<a name="a22">&nbsp;</a>
<h2>2. Delete ads with state = "expired"</h2>

<b>controller/method =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/delete</code>
<br /><br />
<b>Parameters =</b><br />
<ul>
<li>language (REQUIRED - lowercase)</li>
<li>number of ads to process (OPTIONAL. Default = 15)</li>
</ul>
<br />
<b>Example =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/delete/english/10</code>
<br />
i.e.<br />
<code>cron.php --run=/flads_mnt/delete/english/10 [--show-output] [--log-file=logfile]</code>
<br />
This will delete 10 ads in the English section of the website that have
state = "expired".
<div style="text-align: right;"><a href="#a2">Automatic Tasks List</a></div>

<a name="a23">&nbsp;</a>
<h2>3. Determine the number of ads per category</h2>

<b>controller/method =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/ad_count_per_cat</code>
<br /><br />
<b>Parameters =</b><br />
&nbsp;&nbsp;&nbsp;(NONE)
<br />
<br />
<b>Example =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/ad_count_per_cat</code>
<br />
i.e.<br />
<code>cron.php --run=/flads_mnt/ad_count_per_cat [--show-output] [--log-file=logfile]</code>
<br />
This will compute the number of active ads in online categories. The 
number of ads in a category is the sum of all active ads in categories
at lower levels.
<br />
<br />
<b>Note:</b> If your website uses 'async/lazy' treeview and you want categories
that contain ads to be highlighted, you must activate this periodic
task. If you do not activate it, categories with ads at lower levels
will not be highlighted in the 'async/lazy' treeview.
<div style="text-align: right;"><a href="#a2">Automatic Tasks List</a></div>

<a name="a24">&nbsp;</a>
<h2>4. Send email alert before ad expires</h2>

<b>controller/method =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/alert_expiration</code>
<br /><br />
<b>Parameters =</b><br />
<ul>
<li>language (REQUIRED - lowercase)</li>
</ul>
<br />
<b>Example =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/alert_expiration/english</code>
<br />
i.e.<br />
<code>cron.php --run=/flads_mnt/alert_expiration/english [--show-output] [--log-file=logfile]</code>
<br />
If you have configured "Send an email to warn ad posters of 
advertisements that are about to expire" in the "website configuration" 
panel, this will send alert email to warn ad posters that an ad posted
 in the English section of the website is about to expire.
<div style="text-align: right;"><a href="#a2">Automatic Tasks List</a></div>

<a name="a25">&nbsp;</a>
<h2>5. Delete user accounts that have never been used</h2>

<b>controller/method =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/delete_users</code>
<br /><br />
<b>Parameters =</b><br />
<ul>
<li>number of days since creation (REQUIRED)</li>
<li>number of user accounts to process (REQUIRED)</li>
</ul>
<br />
<b>Example =</b><br />
&nbsp;&nbsp;&nbsp;<code>flads_mnt/delete_users/30/14</code>
<br />
i.e.<br />
<code>cron.php --run=/flads_mnt/delete_users/30/14 [--show-output] [--log-file=logfile]</code>
<br />
This will delete up to 14 user accounts that have been created more
than 30 days ago and that have never  been used (no login).
<div style="text-align: right;"><a href="#a2">Automatic Tasks List</a></div>

<a name="a3">&nbsp;</a>
<h1>Links</h1>

<div style="text-align: right;"><a href="#a0">ToC</a></div>
<ul>
  <li>Website:<br />
&nbsp;&nbsp;&nbsp;<a href="http://fladsclassified.sourceforge.net/" target="_blank">http://fladsclassified.sourceforge.net/</a><br />
  </li>
  <li>Administration Manual:<br />
&nbsp;&nbsp;&nbsp;<a href="http://fladsclassified.sourceforge.net/doc.html" target="_blank">http://fladsclassified.sourceforge.net/doc.html</a><br />
  </li>
  <li>Help forum:<br />
&nbsp;&nbsp;&nbsp;<a href="http://sourceforge.net/forum/forum.php?forum_id=757943" target="_blank">http://sourceforge.net/forum/forum.php?forum_id=757943</a>
  </li>
  <li>CodeIgniter website:<br />
&nbsp;&nbsp;&nbsp;<a href="http://www.codeigniter.com/" target="_blank">http://www.codeigniter.com/</a> </li>
  <li>Cron job bootstrapper for CodeIgniter:<br />
&nbsp;&nbsp;&nbsp;<a href="http://codeigniter.com/forums/viewthread/88635/" target="_blank">http://codeigniter.com/forums/viewthread/88635/</a> </li>
</ul>
<br />
</div>

</body>
</html>
Return current item: FladsClassifieds