Alexander Nicolaysen Sørnes : Control Center: Show queries needed to fix note links
Alexander Nicolaysen Sørnes
asornes at winehq.org
Sun Apr 24 11:56:30 CDT 2011
Module: appdb
Branch: master
Commit: f024989c2a407d0b16ab63741ad7ca7567148f52
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=f024989c2a407d0b16ab63741ad7ca7567148f52
Author: Alexander Nicolaysen Sørnes <alexsornes at gmail.com>
Date: Sun Apr 24 18:56:06 2011 +0200
Control Center: Show queries needed to fix note links
---
admin.php | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 92 insertions(+), 1 deletions(-)
diff --git a/admin.php b/admin.php
index 2a4f757..d37918c 100644
--- a/admin.php
+++ b/admin.php
@@ -39,10 +39,97 @@ function updateVersionMaintainerStates()
echo "Updated $i entries";
}
+function fixNoteLinks()
+{
+ // Notes shown for app and all versions
+ $hResult = query_parameters("SELECT * FROM appNotes WHERE versionId = '?'", APPNOTE_SHOW_FOR_ALL);
+
+ echo 'The following notes are set to show for app and all versions:<br />';
+ while(($oRow = mysql_fetch_object($hResult)))
+ {
+ $oNote = new note(null, $oRow);
+ $iNoteId = $oNote->objectGetId();
+ $oApp = new Application($oNote->iAppId);
+ echo 'ID: '.$oNote->objectGetId().'<br />';
+ echo 'App: '.$oApp->objectMakeLink().'<br />';
+
+ $aVersions = $oApp->GetVersions(true);
+ foreach($aVersions as $oVersion)
+ {
+ $iVersionId = $oVersion->objectGetId();
+ $sFix = "INSERT INTO tags_NoteVersion_assignments (tagId,taggedId) VALUES('$iVersionId','$iNoteId')";
+ echo "$sFix<br />";
+ }
+
+ echo '<br />';
+ }
+
+
+ // Notes shown for all versions
+ $hResult = query_parameters("SELECT * FROM appNotes WHERE versionId = '?'", APPNOTE_SHOW_FOR_VERSIONS);
+
+ echo '<br /><br />The following notes are set to show for all versions:<br />';
+ while(($oRow = mysql_fetch_object($hResult)))
+ {
+ $oNote = new note(null, $oRow);
+ $iNoteId = $oNote->objectGetId();
+ $oApp = new Application($oNote->iAppId);
+ echo 'ID: '.$oNote->objectGetId().'<br />';
+ echo 'App: '.$oApp->objectMakeLink().'<br />';
+
+ $aVersions = $oApp->GetVersions(true);
+ foreach($aVersions as $oVersion)
+ {
+ $iVersionId = $oVersion->objectGetId();
+ $sFix = "INSERT INTO tags_NoteVersion_assignments (tagId,taggedId) VALUES('$iVersionId','$iNoteId')";
+ echo "$sFix<br />";
+ }
+
+ echo '<br />';
+ }
+
+ // Notes shown for specific versions
+ $hResult = query_parameters("SELECT * FROM appNotes WHERE versionId = '?'", APPNOTE_SHOW_FOR_SPECIFIC_VERSIONS);
+
+ echo '<br /><br />The following notes are set to show for specific versions:<br />';
+ while(($oRow = mysql_fetch_object($hResult)))
+ {
+ $oNote = new note(null, $oRow);
+ $iNoteId = $oNote->objectGetId();
+ $oApp = new Application($oNote->iAppId);
+ echo 'ID: '.$oNote->objectGetId().'<br />';
+ echo 'App: '.$oApp->objectMakeLink().'<br />';
+ echo '<br />';
+
+ $hResult = query_parameters("SELECT DISTINCT(versionId) FROM appNotes WHERE linkedWith = '?'", $oNote->objectGetId());
+
+ while(($oRow = mysql_fetch_object($hResult)))
+ {
+ $iVersionId = $oRow->versionId;
+ $sFix = "INSERT INTO tags_NoteVersion_assignments (tagId,taggedId) VALUES('$iVersionId','$iNoteId')";
+ echo "$sFix<br />";
+ }
+ }
+
+ // Notes shown for app
+ $hResult = query_parameters("SELECT * FROM appNotes WHERE versionId = '?'", APPNOTE_SHOW_FOR_APP);
+
+ echo '<br /><br />The following notes are set to show on app page:<br />';
+ while(($oRow = mysql_fetch_object($hResult)))
+ {
+ $oNote = new note(null, $oRow);
+ $oApp = new Application($oNote->iAppId);
+ echo 'ID: '.$oNote->objectGetId().'<br />';
+ echo 'App: '.$oApp->objectMakeLink().'<br />';
+ echo '<br />';
+ }
+}
+
function showChoices()
{
+ echo '<a href="admin.php?sAction=fixNoteLinks">Fix/Show note links</a><br />';
echo '<a href="admin.php?sAction=updateAppMaintainerStates">Update application maintainer states</a><br />';
- echo '<a href="admin.php?sAction=updateVersionMaintainerStates">Update version maintainer states</a>';
+ echo '<a href="admin.php?sAction=updateVersionMaintainerStates">Update version maintainer states</a><br />';
}
switch(getInput('sAction', $aClean))
@@ -55,6 +142,10 @@ switch(getInput('sAction', $aClean))
updateVersionMaintainerStates();
break;
+ case 'fixNoteLinks':
+ fixNoteLinks();
+ break;
+
default:
showChoices();
break;
More information about the wine-cvs
mailing list