cvs: pearweb /include pear-database.php /public_html package-edit.php package-info.php /sql packages.sql

From: Date: Thu, 13 Oct 2005 10:42:41 +0000
Subject: cvs: pearweb /include pear-database.php /public_html package-edit.php package-info.php /sql packages.sql
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-35492@lists.php.net to get a copy of this message
mj Thu Oct 13 06:42:41 2005 EDT Modified files: /pearweb/include pear-database.php /pearweb/public_html package-edit.php package-info.php /pearweb/sql packages.sql Log: * Added possibility to mark a package as deprecated. # Bug: #5623 # Submitted by: Arnaud Limbourg

http://cvs.php.net/diff.php/pearweb/include/pear-database.php?r1=1.293&r2=1.294&ty=u Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.293 pearweb/include/pear-database.php:1.294 --- pearweb/include/pear-database.php:1.293 Tue Oct 11 11:02:05 2005 +++ pearweb/include/pear-database.php Thu Oct 13 06:42:37 2005 @@ -17,7 +17,7 @@ | Tomas V.V.Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database.php,v 1.293 2005/10/11 15:02:05 pajoye Exp $ + $Id: pear-database.php,v 1.294 2005/10/13 10:42:37 mj Exp $ */ require_once 'DB/storage.php'; @@ -675,7 +675,8 @@ "p.summary AS summary, p.homepage AS homepage, ". "p.description AS description, p.cvs_link AS cvs_link, ". "p.doc_link as doc_link, ". - "p.wiki_area as wiki_area". + "p.unmaintained AS unmaintained,". + "p.newpk_id AS newpk_id". " FROM packages p, categories c ". "WHERE " . $package_type . " c.id = p.category AND p.{$what} = ?"; $rel_sql = "SELECT version, id, doneby, license, summary, ". @@ -687,6 +688,7 @@ $deps_sql = "SELECT type, relation, version, name, release, optional FROM deps WHERE package = ? ORDER BY optional ASC"; + $newpk_sql = "SELECT name FROM packages WHERE id=?"; if ($field === null) { $info = $dbh->getRow($pkg_sql, array($pkg), DB_FETCHMODE_ASSOC); @@ -698,6 +700,9 @@ $info['notes'] = $dbh->getAssoc($notes_sql, false, array(@$info['packageid']), DB_FETCHMODE_ASSOC); + if (isset($info['newpk_id'])) { + $info['new_package'] = $dbh->getOne($newpk_sql, $info['newpk_id']); + } $deps = $dbh->getAll($deps_sql, array(@$info['packageid']), DB_FETCHMODE_ASSOC); @@ -827,7 +832,7 @@ "SELECT p.name, r.id AS rid, r.version AS stable, r.state AS state ". "FROM packages p, releases r ". "WHERE " . $package_type . - "p.id = r.package ". + ' p.id = r.package ' . $release_state . "ORDER BY r.releasedate ASC ", false, null, DB_FETCHMODE_ASSOC); $stablereleases = $dbh->getAssoc( "SELECT p.name, r.id AS rid, r.version AS stable, r.state AS state ". http://cvs.php.net/diff.php/pearweb/public_html/package-edit.php?r1=1.35&r2=1.36&ty=u Index: pearweb/public_html/package-edit.php diff -u pearweb/public_html/package-edit.php:1.35 pearweb/public_html/package-edit.php:1.36 --- pearweb/public_html/package-edit.php:1.35 Fri Sep 9 10:21:06 2005 +++ pearweb/public_html/package-edit.php Thu Oct 13 06:42:41 2005 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: package-edit.php,v 1.35 2005/09/09 14:21:06 pajoye Exp $ + $Id: package-edit.php,v 1.36 2005/10/13 10:42:41 mj Exp $ */ /* @@ -26,8 +26,8 @@ $self = htmlspecialchars(strip_tags($_SERVER['SCRIPT_NAME'])); -require_once 'HTML/Form.php'; -$form = new HTML_Form($self); +require_once 'pear-format-html-form.php'; +$form = new PEAR_Web_Form($self); response_header('Edit Package'); ?> @@ -72,7 +72,7 @@ $query = 'UPDATE packages SET name = ?, license = ?, summary = ?, description = ?, category = ?, homepage = ?, package_type = ?, doc_link = ?, cvs_link = ?, - wiki_area = ? + unmaintained = ?, newpk_id = ? WHERE id = ?'; $qparams = array( @@ -85,7 +85,8 @@ 'pear', $_POST['doc_link'], $_POST['cvs_link'], - isset($_POST['wiki_area']) ? 1 : 0, + isset($_POST['unmaintained']) ? 1 : 0 , + isset($_POST['newpk_id']) ? $_POST['newpk_id'] : null, $package_id ); @@ -94,83 +95,10 @@ if (PEAR::isError($sth)) { report_error('Unable to save data!'); } else { - $pear_rest->savePackageREST($_POST['name']); - $wikidb = DB::connect(PEAR_WIKI_DSN); - - $area_query = 'INSERT INTO yawiki_areas (name,title) VALUES (?,?)'; - - $prep = $wikidb->prepare($area_query); - $res = $wikidb->execute($prep, array($_POST['name'], $_POST['name'])); - - if (PEAR::isError($res)) { - report_error('Cannot create the wiki area'); - } - - $area_query = 'INSERT INTO yawiki_store (area,page,body,dt,username) VALUES (?,?,?,?,?)'; - - $data = array( - $_POST['name'], 'HomePage', - 'This is ' . $_POST['name'] . ' package HomePage', - date('Y-m-d H:i:s'), - 'pear-qa' - ); - - $prep = $wikidb->prepare($area_query); - $res = $wikidb->execute($prep, $data); - - if (PEAR::isError($res)) { - report_error('Cannot create the main page of the area'); - response_footer(); - exit; - } - - $data = array( - $_POST['name'], 'AreaMap', - 'HomePage', - date('Y-m-d H:i:s'), - 'pear-qa' - ); - - $prep = $wikidb->prepare($area_query); - $res = $wikidb->execute($prep, $data); - - if (PEAR::isError($res)) { - report_error('Cannot create the area map'); - response_footer(); - exit; - } - - $query = 'INSERT INTO yawiki_acl (id, seq, flag, username, priv, - area, page) VALUES (?, ?, ?, ?, ?, ?, ?)'; - - $maintainers = maintainer::get($_GET['id']); - $accounts = array(); - - foreach ($maintainers as $handle => $row) { - if ($row['role'] == 'lead') { - $accounts[] = array( - $wikidb->nextId('_yawiki_acl_id'), - 100, 1, $handle, 'area_admin', $_POST['name'], '*' - ); - } - } - - // Add the ACL only if there are lead(s) declared - if (count($accounts) > 0) { - $prep = $wikidb->prepare($query); - $res = $wikidb->executeMultiple($prep, $accounts); - } - - if (PEAR::isError($res)) { - report_error('Cannot create the wiki area ACL entries'); - response_footer(); - exit; - } - } - + $pear_rest->savePackageREST($_POST['name']); echo "<b>Package information successfully updated.</b><br /><br />\n"; } - + } } else if (isset($_GET['action'])) { switch ($_GET['action']) { case 'release_remove': @@ -260,16 +188,33 @@ </td> </tr> <tr> - <th class="form-label_left">Activate wiki area ?</th> + <th class="form-label_left">Is this package unmaintained ?</th> + <td class="form-input"> + <?php $form->displayCheckbox('unmaintained', ($row['unmaintained']) ? true : false); ?> + </td> +</tr> +<tr> + <th class="form-label_left">New package (superceeding this one):</th> <td class="form-input"> - <?php $wiki_area = ($row['wiki_area'] == 1) ? 'readonly="readonly" disabled="disabled"' : ''; - $form->displayCheckbox('wiki_area', ($row['wiki_area']) ? true : false, $wiki_area); ?> +<?php +$packages = package::listAllwithReleases(); + +$rows = array(0 => ""); +foreach ($packages as $id => $info) { + if ($id == $package_id) { + continue; + } + $rows[$id] = $info['name']; +} + +$form->displaySelect('newpk_id', $rows, (int)$row['newpk_id']); +?> </td> </tr> <tr> <th class="form-label_left">&nbsp;</th> <td class="form-input"><input type="submit" name="submit" value="Save changes" />&nbsp; - <input type="reset" name="cancel" value="Cancel" onClick="javascript:window.location.href='/package/<?php echo $_GET['id']; ?>'; return false" /> + <input type="reset" name="cancel" value="Cancel" onClick="javascript:window.location.href='/package/<?php echo htmlspecialchars($_GET['id']); ?>'; return false" /> </td> </tr> </table> http://cvs.php.net/diff.php/pearweb/public_html/package-info.php?r1=1.109&r2=1.110&ty=u Index: pearweb/public_html/package-info.php diff -u pearweb/public_html/package-info.php:1.109 pearweb/public_html/package-info.php:1.110 --- pearweb/public_html/package-info.php:1.109 Sat Sep 10 20:01:42 2005 +++ pearweb/public_html/package-info.php Thu Oct 13 06:42:41 2005 @@ -16,7 +16,7 @@ | Authors: Martin Jansen <mj@php.net> | | Tomas V.V.Cox <cox@idecnet.com> | +----------------------------------------------------------------------+ - $Id: package-info.php,v 1.109 2005/09/11 00:01:42 pajoye Exp $ + $Id: package-info.php,v 1.110 2005/10/13 10:42:41 mj Exp $ */ @@ -74,11 +74,6 @@ $action = $params['action']; break; - case 'wiki': - header('Location: ' . PEAR_WIKI_URL . '/index.php?area=' . urlencode($pkg['name'])); - exit(); - break; - case 'redirected' : $redirected = true; $params['action']= ''; @@ -113,16 +108,18 @@ } -$name = $pkg['name']; -$type = $pkg['type']; -$summary = stripslashes($pkg['summary']); -$license = $pkg['license']; -$description = stripslashes($pkg['description']); -$category = $pkg['category']; -$homepage = $pkg['homepage']; -$pacid = $pkg['packageid']; -$cvs_link = $pkg['cvs_link']; -$doc_link = $pkg['doc_link']; +$name = $pkg['name']; +$type = $pkg['type']; +$summary = stripslashes($pkg['summary']); +$license = $pkg['license']; +$description = stripslashes($pkg['description']); +$category = $pkg['category']; +$homepage = $pkg['homepage']; +$pacid = $pkg['packageid']; +$cvs_link = $pkg['cvs_link']; +$doc_link = $pkg['doc_link']; +$unmaintained = ($pkg['unmaintained']) ? 'Y' : 'N'; +$new_package = htmlspecialchars($pkg['new_package']); // Maintainer information $maintainers = maintainer::get($pacid); @@ -185,6 +182,46 @@ // {{{ General information + /* UNMAINTAINED OR SUPERCEEDED PACKAGES WARNING */ + $dec_messages = array( + 'abandonned' => 'This package is not maintained anymore and has been superceeded by <a href="/package/{{PACKAGE_NAME}}">{{PACKAGE_NAME}}</a>.', + 'superceeded' => 'This package been superceeded by <a href="/package/{{PACKAGE_NAME}}">{{PACKAGE_NAME}}</a> but is still maintained for bugs and security fixes', + 'unmaintained' => 'This package is not maintained, if you would like to take over please go to <a href="http://pear.php.net/manual/en/guide-newmaint.php">this page</a>' + ); + + $dec_table = array( + 'abandonned' => array('superceeded' => 'Y', 'unmaintained' => 'Y'), + 'superceeded' => array('superceeded' => 'Y', 'unmaintained' => 'N'), + 'unmaintained' => array('superceeded' => 'N', 'unmaintained' => 'Y'), + ); + + $superceeded = 'N'; + if ($new_package != '') { + $superceeded = 'Y'; + } + + $apply_rule = null; + foreach ($dec_table as $rule => $conditions) { + $match = true; + foreach ($conditions as $condition => $value) { + if ($$condition != $value) { + $match = false; + break; + } + } + if ($match) { + $apply_rule = $rule; + } + } + + if (!is_null($apply_rule) && isset($dec_messages[$apply_rule])) { + $str = '<div class="warnings">'; + $str .= str_replace('{{PACKAGE_NAME}}', $new_package, $dec_messages[$apply_rule]); + $str .= '</div>'; + echo $str; + } + /* UNMAINTAINED OR SUPERCEEDED PACKAGES WARNING */ + print '<table border="0" cellspacing="0" cellpadding="2" style="width: 100%">'; print '<tr>'; print '<th class="headrow" style="width: 50%">&raquo; Summary</th>'; http://cvs.php.net/diff.php/pearweb/sql/packages.sql?r1=1.17&r2=1.18&ty=u Index: pearweb/sql/packages.sql diff -u pearweb/sql/packages.sql:1.17 pearweb/sql/packages.sql:1.18 --- pearweb/sql/packages.sql:1.17 Thu Aug 11 13:06:31 2005 +++ pearweb/sql/packages.sql Thu Oct 13 06:42:41 2005 @@ -17,6 +17,8 @@ cvs_link varchar(255) default NULL, approved tinyint(4) NOT NULL default '0', wiki_area tinyint(1) NOT NULL default '0', + unmaintained tinyint(1) NOT NULL default '0', + newpk_id int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY name (name), KEY category (category)
« previous php.pear.cvs (#35492) next »