Module: appdb Branch: master Commit: 98cc98c38aead5e32746a1fa3aaf5bcc34397729 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=98cc98c38aead5e32746a1fa3...
Author: Alexander Nicolaysen Sørnes <alexander@linux-xqqm.(none)> Date: Thu Nov 12 17:31:58 2009 +0100
Add ability to update all versions' maintainer states
---
updateMaintainerStates.php | 54 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/updateMaintainerStates.php b/updateMaintainerStates.php index 8791c51..f8644aa 100644 --- a/updateMaintainerStates.php +++ b/updateMaintainerStates.php @@ -7,16 +7,56 @@ require_once('include/maintainer.php'); if(!$_SESSION['current']->hasPriv('admin')) util_show_error_page_and_exit("Only admins are allowed in here");
-$hResult = application::objectGetEntries('accepted'); +function updateAppMaintainerStates() +{ + $hResult = application::objectGetEntries('accepted'); + + $i = 0; + while($oRow = mysql_fetch_object($hResult)) + { + $oApp = new application(null, $oRow); + $oApp->updateMaintainerState(); + $i++; + } + + echo "Updated $i entries"; +} + +function updateVersionMaintainerStates() +{ + $hResult = version::objectGetEntries('accepted'); + + $i = 0; + while($oRow = mysql_fetch_object($hResult)) + { + $oVersion = new version(null, $oRow); + $oVersion->updateMaintainerState(); + $i++; + }
-$i = 0; -while($oRow = mysql_fetch_object($hResult)) + echo "Updated $i entries"; +} + +function showChoices() { - $oApp = new application(null, $oRow); - $oApp->updateMaintainerState(); - $i++; + echo '<a href="updateMaintainerStates.php?sAction=updateAppMaintainerStates">Update application maintainer states</a><br />'; + echo '<a href="updateMaintainerStates.php?sAction=updateVersionMaintainerStates">Update version maintainer states</a>'; +} + +switch(getInput('sAction', $aClean)) +{ + case 'updateAppMaintainerStates': + updateAppMaintainerStates(); + break; + + case 'updateVersionMaintainerStates': + updateVersionMaintainerStates(); + break; + + default: + showChoices(); + break; }
-echo "Updated $i entries";
?>