SHARE
    TWEET
    Krenair

    OS migration script changes

    Dec 21st, 2012
    127
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Diff 4.85 KB | None | 0 0
    1. diff --git a/migrateToRevDel.php b/migrateToRevDel.php
    2. index 4722106..4b9673b 100644
    3. --- a/migrateToRevDel.php
    4. +++ b/migrateToRevDel.php
    5. @@ -79,26 +79,60 @@ class MigrateOversightRevisions extends Maintenance {
    6. $insertData[$fieldPrefix . 'len'] = strlen( $revText );
    7. $insertData[$fieldPrefix . 'sha1'] = Revision::base36Sha1( $revText );
    8. - $parentIdLookupConditions = array(
    9. - $pageIdFieldName => $hiddenRow->hidden_page,
    10. - $fieldPrefix . 'timestamp' => $hiddenRow->hidden_timestamp,
    11. - $revIdFieldName . ' < ' . $hiddenRow->hidden_rev_id
    12. - );
    13. -
    14. if ( $tableName == 'archive' ) {
    15. - $parentIdLookupConditions['ar_namespace'] = $hiddenRow->hidden_namespace;
    16. - $parentIdLookupConditions['ar_title'] = $hiddenRow->hidden_title;
    17. + $insertData['ar_parent_id'] = null;
    18. $insertData['ar_namespace'] = $hiddenRow->hidden_namespace;
    19. $insertData['ar_title'] = $hiddenRow->hidden_title;
    20. + } else {
    21. + $parentIdFromRevision = $dbw->selectRow(
    22. + 'revision',
    23. + array( 'rev_id', 'rev_timestamp' ),
    24. + array(
    25. + 'rev_page' => $hiddenRow->hidden_page,
    26. + 'rev_timestamp < ' . $hiddenRow->hidden_timestamp,
    27. + 'rev_id < ' . $hiddenRow->hidden_rev_id
    28. + ),
    29. + array(
    30. + 'LIMIT' => 1,
    31. + 'ORDER BY' => 'rev_timestamp'
    32. + )
    33. + );
    34. + $parentIdFromHidden = $dbw->selectRow(
    35. + 'hidden',
    36. + array( 'hidden_rev_id', 'hidden_timestamp' ),
    37. + array(
    38. + 'hidden_page' => $hiddenRow->hidden_page,
    39. + 'hidden_timestamp < ' . $hiddenRow->hidden_timestamp,
    40. + 'hidden_rev_id < ' . $hiddenRow->hidden_rev_id
    41. + ),
    42. + $options = array(
    43. + 'LIMIT' => 1,
    44. + 'ORDER BY' => 'hidden_timestamp'
    45. + )
    46. + );
    47. + $parentIdFromArchive = $dbw->selectRow(
    48. + 'archive',
    49. + array( 'ar_rev_id', 'ar_timestamp' ),
    50. + array(
    51. + 'ar_page_id' => $hiddenRow->hidden_page,
    52. + 'ar_timestamp < ' . $hiddenRow->hidden_timestamp,
    53. + 'ar_rev_id < ' . $hiddenRow->hidden_rev_id
    54. + ),
    55. + array(
    56. + 'LIMIT' => 1,
    57. + 'ORDER BY' => 'ar_timestamp'
    58. + )
    59. + );
    60. +
    61. + $timestampsToRevIds = array(
    62. + $parentIdFromRevision["rev_timestamp"] => $parentIdFromRevision["rev_id"],
    63. + $parentIdFromHidden["hidden_timestamp"] => $parentIdFromHidden["hidden_rev_id"],
    64. + $parentIdFromArchive["ar_timestamp"] => $parentIdFromArchive["ar_rev_id"]
    65. + );
    66. +
    67. + $insertData['rev_parent_id'] = $timestampsToRevIds[max( array_keys( $timestampsToRevIds ) )];
    68. }
    69. - $insertData[$fieldPrefix . 'parent_id'] = $dbw->selectField(
    70. - $tableName,
    71. - $revIdFieldName,
    72. - $parentIdLookupConditions,
    73. - $options = array( 'LIMIT' => 1, 'ORDER BY' => $revIdFieldName )
    74. - );
    75. -
    76. $dbw->insert( $tableName, $insertData, __METHOD__ );
    77. $dbw->insert( 'logging', array(
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /