Ejemplo n.º 1
0
 /**
  * Updates the tip database. Expects an array of page names.
  * 
  * This method clears all page names and re-creates them. This saves
  * alot of engineering, because we don't need to match contents
  * within the database against contents in an array.
  * 
  * @param array $aPageNames The page names as array. Page names are stored as string.
  */
 private static function updateTipDatabase(array $aPageNames)
 {
     $dql = "DELETE FROM PartKeepr\\TipOfTheDay\\TipOfTheDay";
     $query = PartKeepr::getEM()->createQuery($dql);
     $query->execute();
     foreach ($aPageNames as $pageName) {
         $tip = new TipOfTheDay();
         $tip->setName($pageName);
         PartKeepr::getEM()->persist($tip);
     }
     PartKeepr::getEM()->flush();
 }
Ejemplo n.º 2
0
<?php

/**
 * Updates the tip of the day title index.
 * Typically scheduled once or twice a day.
 * 
 * The API to retrieve tips has an upper limit of 500 requests/day, so don't schedule this each minute.
 * 
 * @author felicitus
 *
 */
namespace PartKeepr\Cronjobs;

include __DIR__ . "/../src/backend/PartKeepr/PartKeepr.php";
use PartKeepr\PartKeepr, PartKeepr\TipOfTheDay\TipOfTheDay, PartKeepr\CronLogger\CronLoggerManager;
PartKeepr::initialize();
TipOfTheDay::syncTips();
CronLoggerManager::getInstance()->markCronRun(basename(__FILE__));