diff --git a/private/bin/retroBuildIDs.php b/private/bin/retroBuildIDs.php index 200188c..5aeb3e7 100644 --- a/private/bin/retroBuildIDs.php +++ b/private/bin/retroBuildIDs.php @@ -11,7 +11,6 @@ $pdo = new PDO("mysql:host=localhost;dbname=fdn_old","root","root",array(PDO::MY $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $count = 0; -// $statement = $pdo->query("select * from notizia order by id desc limit $count,100"); $statement = $pdo->query("select * from notizia order by id desc limit $count,100"); $dati = $statement->fetchALL(PDO::FETCH_CLASS,"stdClass"); @@ -25,24 +24,19 @@ while (is_array($dati) && sizeof($dati)>0){ $notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("titolo"=>htmlspecialchars_decode($ele->mainTitle))); } - if (is_null($notizia)){ - var_dump($ele); - } - if (!is_null($notizia)){ -// $notizia->oldId = $ele->id; + $notizia->oldId = intval($ele->id); -// GlobalVariables::get("dao")->save($notizia); + GlobalVariables::get("dao")->save($notizia); } else { - echo $ele->id."\n"; + echo "Failed id ". $ele->id."\n"; } } - $dati = array(); -// $count+=100; -// $statement = $pdo->query("select * from notizia order by id desc limit $count,100"); -// $dati = $statement->fetchALL(PDO::FETCH_CLASS,"stdClass"); + $count+=100; + $statement = $pdo->query("select * from notizia order by id desc limit $count,100"); + $dati = $statement->fetchALL(PDO::FETCH_CLASS,"stdClass"); } diff --git a/public/oldArticleRedirect.php b/public/oldArticleRedirect.php new file mode 100644 index 0000000..f74e70d --- /dev/null +++ b/public/oldArticleRedirect.php @@ -0,0 +1,21 @@ +getFirst("NotiziaModel",array("oldId"=>$id)); + + if (!is_null($notizia)){ + GUIHandler::redirect("articolo.php?id=".$notizia->id); + } + else { + echo "asd"; + } +} + +?> \ No newline at end of file