Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / tests [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
09 Aug 2002 16:12:14postnuke_official/testsimport8.php,1.12,1.13Mike
 import article/section/topic/cat counters + add optimize table

Update of /home/cvsroot/postnuke_official/tests
In directory ns7.hostnuke.net:/tmp/cvs-serv22170

Modified Files:
	import8.php 
Log Message:
import article/section/topic/cat counters + add optimize table


Index: import8.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/tests/import8.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** import8.php	5 Aug 2002 01:49:56 -0000	1.12
--- import8.php	9 Aug 2002 16:12:12 -0000	1.13
***************
*** 129,132 ****
--- 129,133 ----
      if ($reset && $startnum == 0) {
          $dbconn->Execute("DELETE FROM " . $pntable['users'] . " WHERE pn_uid > 2");
+         $dbconn->Execute('FLUSH TABLE ' . $pntable['users']);
      }
      $num = 1;
***************
*** 172,179 ****
      if ($resetcat) {
          $dbconn->Execute("DELETE FROM " . $pntable['categories']);
      }
      if ($reset) {
-         $regid = pnModGetIDFromName('articles');
          $dbconn->Execute("DELETE FROM " . $pntable['categories_linkage'] . " WHERE pn_modid=$regid");
      }
      echo "Creating root for old news topics<br>\n";
--- 173,190 ----
      if ($resetcat) {
          $dbconn->Execute("DELETE FROM " . $pntable['categories']);
+         $dbconn->Execute('FLUSH TABLE ' . $pntable['categories']);
      }
+     $regid = pnModGetIDFromName('articles');
      if ($reset) {
          $dbconn->Execute("DELETE FROM " . $pntable['categories_linkage'] . " WHERE pn_modid=$regid");
+         $dbconn->Execute('FLUSH TABLE ' . $pntable['categories_linkage']);
+     }
+     if (pnModAvailable('hitcount') && pnModAPILoad('hitcount','user')) {
+         if ($reset) {
+             $regid2 = pnModGetIDFromName('categories');
+             $dbconn->Execute("DELETE FROM " . $pntable['hitcount'] . " WHERE pn_moduleid = " . $regid2);
+             $dbconn->Execute('FLUSH TABLE ' . $pntable['hitcount']);
+         }
+         $docounter = 1;
      }
      echo "Creating root for old news topics<br>\n";
***************
*** 200,204 ****
                                   'parent_id' => $categories));
  
!     $query = 'SELECT pn_topicid, pn_topicname, pn_topictext, pn_topicimage
                FROM ' . $oldprefix . '_topics
                ORDER BY pn_topicid ASC';
--- 211,215 ----
                                   'parent_id' => $categories));
  
!     $query = 'SELECT pn_topicid, pn_topicname, pn_topictext, pn_topicimage, pn_counter
                FROM ' . $oldprefix . '_topics
                ORDER BY pn_topicid ASC';
***************
*** 208,212 ****
      }
      while (!$result->EOF) {
!         list($id, $name, $text, $image) = $result->fields;
          $topicid[$id] = pnModAPIFunc('categories', 'admin', 'create', array(
                                'name' => $text,
--- 219,223 ----
      }
      while (!$result->EOF) {
!         list($id, $name, $text, $image, $counter) = $result->fields;
          $topicid[$id] = pnModAPIFunc('categories', 'admin', 'create', array(
                                'name' => $text,
***************
*** 215,223 ****
                                'parent_id' => $topics));
          echo "Creating topic ($id) $text - $name [$image]<br>\n";
          $result->MoveNext();
      }
      $result->Close();
  
!     $query = 'SELECT pn_catid, pn_title
                FROM ' . $oldprefix . '_stories_cat
                ORDER BY pn_catid ASC';
--- 226,244 ----
                                'parent_id' => $topics));
          echo "Creating topic ($id) $text - $name [$image]<br>\n";
+         if (!empty($docounter)) {
+             $counter--;
+             $hits = pnModAPIFunc('hitcount','user','hit',array('modname' => 'categories',
+                                                                'objectid' => $topicid[$id],
+                                                                'hits' => $counter));
+             $counter++;
+             if ($hits != $counter) {
+                 echo "Hits $hits don't match counter $counter for topic $topicid[$id] $text<br>\n";
+             }
+         }
          $result->MoveNext();
      }
      $result->Close();
  
!     $query = 'SELECT pn_catid, pn_title, pn_counter
                FROM ' . $oldprefix . '_stories_cat
                ORDER BY pn_catid ASC';
***************
*** 227,231 ****
      }
      while (!$result->EOF) {
!         list($id, $title) = $result->fields;
          $catid[$id] = pnModAPIFunc('categories', 'admin', 'create', array(
                                'name' => $title,
--- 248,252 ----
      }
      while (!$result->EOF) {
!         list($id, $title, $counter) = $result->fields;
          $catid[$id] = pnModAPIFunc('categories', 'admin', 'create', array(
                                'name' => $title,
***************
*** 233,236 ****
--- 254,267 ----
                                'parent_id' => $categories));
          echo "Creating category ($id) $title - $title<br>\n";
+         if (!empty($docounter)) {
+             $counter--;
+             $hits = pnModAPIFunc('hitcount','user','hit',array('modname' => 'categories',
+                                                                'objectid' => $catid[$id],
+                                                                'hits' => $counter));
+             $counter++;
+             if ($hits != $counter) {
+                 echo "Hits $hits don't match counter $counter for category $catid[$id] $title<br>\n";
+             }
+         }
          $result->MoveNext();
      }
***************
*** 261,265 ****
      $query = 'SELECT pn_sid, pn_title, pn_hometext, pn_bodytext, pn_aid,
                       UNIX_TIMESTAMP(pn_time), pn_language, pn_catid, pn_topic,
!                      pn_notes, pn_ihome
                FROM ' . $oldprefix . '_stories
                ORDER BY pn_sid ASC';
--- 292,296 ----
      $query = 'SELECT pn_sid, pn_title, pn_hometext, pn_bodytext, pn_aid,
                       UNIX_TIMESTAMP(pn_time), pn_language, pn_catid, pn_topic,
!                      pn_notes, pn_ihome, pn_counter
                FROM ' . $oldprefix . '_stories
                ORDER BY pn_sid ASC';
***************
*** 278,286 ****
      if ($reset && $startnum == 0) {
          $dbconn->Execute("DELETE FROM " . $pntable['articles']);
      }
      $num = 1;
      while (!$result->EOF) {
          list($aid, $title, $summary, $body, $authorid, $pubdate, $language,
!             $cat, $topic, $notes, $ihome) = $result->fields;
          if (empty($ihome)) {
              $status = 3;
--- 309,325 ----
      if ($reset && $startnum == 0) {
          $dbconn->Execute("DELETE FROM " . $pntable['articles']);
+         $dbconn->Execute('FLUSH TABLE ' . $pntable['articles']);
+     }
+     if (pnModAvailable('hitcount') && pnModAPILoad('hitcount','user')) {
+         if ($reset && $startnum == 0) {
+             $dbconn->Execute("DELETE FROM " . $pntable['hitcount'] . " WHERE pn_moduleid = " . $regid);
+             $dbconn->Execute('FLUSH TABLE ' . $pntable['hitcount']);
+         }
+         $docounter = 1;
      }
      $num = 1;
      while (!$result->EOF) {
          list($aid, $title, $summary, $body, $authorid, $pubdate, $language,
!             $cat, $topic, $notes, $ihome, $counter) = $result->fields;
          if (empty($ihome)) {
              $status = 3;
***************
*** 314,317 ****
--- 353,366 ----
          }
          $num++;
+         if (!empty($docounter)) {
+             $counter--;
+             $hits = pnModAPIFunc('hitcount','user','hit',array('modname' => 'articles',
+                                                                'objectid' => $aid,
+                                                                'hits' => $counter));
+             $counter++;
+             if ($hits != $counter) {
+                 echo "Hits $hits don't match counter $counter for article $aid $title<br>\n";
+             }
+         }
          $cids = array();
          if (isset($topicid[$topic])) {
***************
*** 472,476 ****
      $sectionid = unserialize(pnModGetVar('import','sectionid'));
      echo "<strong>6. Importing section content</strong><br>\n";
!     $query = 'SELECT pn_artid, pn_secid, pn_title, pn_content, pn_language
                FROM ' . $oldprefix . '_seccont
                ORDER BY pn_artid ASC';
--- 521,525 ----
      $sectionid = unserialize(pnModGetVar('import','sectionid'));
      echo "<strong>6. Importing section content</strong><br>\n";
!     $query = 'SELECT pn_artid, pn_secid, pn_title, pn_content, pn_language, pn_counter
                FROM ' . $oldprefix . '_seccont
                ORDER BY pn_artid ASC';
***************
*** 479,484 ****
          die("Oops, select section content failed : " . $dbconn->ErrorMsg());
      }
      while (!$result->EOF) {
!         list($artid, $secid, $title, $content, $language) = $result->fields;
          $nextId = $dbconn->GenId($pntable['articles']);
          $insert = 'INSERT INTO ' . $pntable['articles'] . ' 
--- 528,536 ----
          die("Oops, select section content failed : " . $dbconn->ErrorMsg());
      }
+     if (pnModAvailable('hitcount') && pnModAPILoad('hitcount','user')) {
+         $docounter = 1;
+     }
      while (!$result->EOF) {
!         list($artid, $secid, $title, $content, $language, $counter) = $result->fields;
          $nextId = $dbconn->GenId($pntable['articles']);
          $insert = 'INSERT INTO ' . $pntable['articles'] . ' 
***************
*** 503,506 ****
--- 555,570 ----
              echo "Inserted section content ($artid) $title<br>\n";
          }
+         // Get aid to return
+         $aid = $dbconn->PO_Insert_ID($pntable['articles'], 'pn_aid');
+         if (!empty($docounter)) {
+             $counter--;
+             $hits = pnModAPIFunc('hitcount','user','hit',array('modname' => 'articles',
+                                                                'objectid' => $aid,
+                                                                'hits' => $counter));
+             $counter++;
+             if ($hits != $counter) {
+                 echo "Hits $hits don't match counter $counter for article $aid $title<br>\n";
+             }
+         }
          $cids = array();
      // TODO: check if we want to add articles to the Sections root too or not
***************
*** 512,517 ****
              $cids[] = $sections;
          }
-         // Get aid to return
-         $aid = $dbconn->PO_Insert_ID($pntable['articles'], 'pn_aid');
          pnModAPIFunc('categories', 'admin', 'linkcat', array(
                       'cids' => $cids,
--- 576,579 ----
***************
*** 629,635 ****
      echo "<strong>TODO : do something with FAQ display</strong><br><br>\n";
  // the end - for now...
! //    echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;
! //          <a href="import8.php?step=' . ($step+1) . '">Go to step ' . ($step+1) . '</a><br>';
! //    }
  
      echo "<strong>TODO : import the rest...</strong><br><br>\n";
--- 691,710 ----
      echo "<strong>TODO : do something with FAQ display</strong><br><br>\n";
  // the end - for now...
!     echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;
!           <a href="import8.php?step=' . ($step+1) . '">Go to step ' . ($step+1) . '</a><br>';
!     }
! 
!     if ($step == 9) {
!     echo "<strong>9. Optimizing database tables</strong><br>\n";
!     $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['users']);
!     if ($dbconn->ErrorNo() != 0) {
!         echo $dbconn->ErrorMsg();
!     }
!     $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['categories']);
!     $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['articles']);
!     $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['categories_linkage']);
!     if (pnModAvailable('hitcount') && pnModAPILoad('hitcount','user')) {
!         $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['hitcount']);
!     }
  
      echo "<strong>TODO : import the rest...</strong><br><br>\n";


Directory filter : [ all ] / postnuke_official / tests [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3