Inizio dockerizzazione
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Script per aggiungere a tutte le notizie il campo 'about.lastEdit'
|
||||
*/
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
$skip = 0;
|
||||
$n=1;
|
||||
$limit = 100;
|
||||
|
||||
$allNotizie = GlobalVariables::get("dao")->query("NotiziaModel",array("deleted"=>array('$exists'=>true)),array("skip"=>$skip,"limit"=>$limit));
|
||||
while(sizeof($allNotizie)>0){
|
||||
foreach ($allNotizie as $notizia){
|
||||
if(property_exists($notizia->about, "data")){
|
||||
$notizia->about->lastEdit = $notizia->about->data;
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
echo $n.") last Edit: ".$notizia->about->lastEdit.PHP_EOL;
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
$skip += $limit;
|
||||
$allNotizie = GlobalVariables::get("dao")->query("NotiziaModel",array("deleted"=>array('$exists'=>true)),array("skip"=>$skip,"limit"=>$limit));
|
||||
}
|
||||
echo "totale notizie: ".sizeof(GlobalVariables::get("dao")->query("NotiziaModel",array("deleted"=>array('$exists'=>true)),array()))."\n";
|
||||
?>
|
||||
Reference in New Issue
Block a user