test.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. require_once('./inc/header.inc.php');
  3. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  4. require_once(BX_DIRECTORY_PATH_INC . "utils.inc.php");
  5. /*
  6. $oDb = BxDolDb::getInstance();
  7. $iCount = 0;
  8. $aCmtsIds = $oDb->getAll("SELECT * FROM `sys_cmts_ids` WHERE 1");
  9. $aCmtsSystems = $oDb->getColumn("SELECT `ID` FROM `sys_objects_cmts` WHERE 1");
  10. foreach($aCmtsIds as $aCmtsId) {
  11. if(in_array($aCmtsId['system_id'], $aCmtsSystems))
  12. continue;
  13. $iCount += (int)$oDb->query("DELETE FROM `sys_cmts_ids` WHERE `id`=:id", array(
  14. 'id' => $aCmtsId['id']
  15. ));
  16. }
  17. echo "Updated: " . $iCount;
  18. */
  19. /*
  20. $oDb = BxDolDb::getInstance();
  21. $aSystems = $oDb->getPairs("SELECT `ID`, `Table` FROM `sys_objects_cmts` WHERE 1", "ID", "Table");
  22. $iUpdated = 0;
  23. $aComments = $oDb->getAll("SELECT * FROM `sys_cmts_ids` WHERE `author_id`='0'");
  24. foreach($aComments as $aComment) {
  25. if(!isset($aSystems[$aComment['system_id']]))
  26. continue;
  27. $iUpdated += $oDb->query("UPDATE `sys_cmts_ids` SET `author_id`=:author_id WHERE `id`=:id LIMIT 1", array(
  28. 'id' => (int)$aComment['id'],
  29. 'author_id' => (int)$oDb->getOne("SELECT `cmt_author_id` FROM `" . $aSystems[$aComment['system_id']] . "` WHERE `cmt_id`=:cmt_id", array(
  30. 'cmt_id' => (int)$aComment['cmt_id']
  31. ))
  32. )) !== false ? 1 : 0;
  33. }
  34. echo "Updated: " . $iUpdated;
  35. */