[aur-dev] [PATCH 1/3] rpc: small optimizations
Signed-off-by: Dan McGee <dan@archlinux.org> --- web/html/rpc.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/html/rpc.php b/web/html/rpc.php index f94d5bc..dc3d20b 100644 --- a/web/html/rpc.php +++ b/web/html/rpc.php @@ -1,13 +1,13 @@ <?php -set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang'); +set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include("aur.inc"); include("aurjson.class.php"); -$rpc_o = new AurJSON(); if ( $_SERVER['REQUEST_METHOD'] == 'GET' ) { if ( isset($_GET['type']) ) { + $rpc_o = new AurJSON(); echo $rpc_o->handle($_GET); } else { -- 1.6.4
All of these are sourcing function libraries so we don't need to include them more than once. Things that insert actual HTML into the output were left calling include(). Signed-off-by: Dan McGee <dan@archlinux.org> --- web/html/account.php | 2 +- web/html/addvote.php | 2 +- web/html/index.php | 4 ++-- web/html/logout.php | 2 +- web/html/packages.php | 8 ++++---- web/html/pkgedit.php | 4 ++-- web/html/pkgsubmit.php | 10 +++++----- web/html/rpc.php | 3 +-- web/html/rss2.php | 4 ++-- web/html/tu.php | 2 +- web/lib/aurjson.class.php | 5 +++-- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/web/html/account.php b/web/html/account.php index c07d2f9..e8a3218 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -2,7 +2,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include('aur.inc'); # access AUR common functions +include_once('aur.inc'); # access AUR common functions include_once('acctfuncs.inc'); # access Account specific functions set_lang(); # this sets up the visitor's language diff --git a/web/html/addvote.php b/web/html/addvote.php index e5fe945..53044c0 100644 --- a/web/html/addvote.php +++ b/web/html/addvote.php @@ -2,7 +2,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); +include_once("aur.inc"); set_lang(); check_sid(); html_header(); diff --git a/web/html/index.php b/web/html/index.php index 3918d95..33c39eb 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -2,11 +2,11 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); +include_once("aur.inc"); set_lang(); check_sid(); -include('stats.inc'); +include_once('stats.inc'); html_header( __("Home") ); diff --git a/web/html/logout.php b/web/html/logout.php index 88a1e26..14c652e 100644 --- a/web/html/logout.php +++ b/web/html/logout.php @@ -2,7 +2,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); # access AUR common functions +include_once("aur.inc"); # access AUR common functions include_once("acctfuncs.inc"); # access AUR common functions diff --git a/web/html/packages.php b/web/html/packages.php index 5b2d5ef..ace4599 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -2,10 +2,10 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); # access AUR common functions -set_lang(); # this sets up the visitor's language -include('pkgfuncs.inc'); # package specific functions -check_sid(); # see if they're still logged in +include_once("aur.inc"); # access AUR common functions +set_lang(); # this sets up the visitor's language +include_once('pkgfuncs.inc'); # package specific functions +check_sid(); # see if they're still logged in # Set the title to the current query if required if (isset($_GET['ID'])) { diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php index 5a711d0..fede693 100644 --- a/web/html/pkgedit.php +++ b/web/html/pkgedit.php @@ -2,8 +2,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); # access AUR common functions -include("pkgfuncs.inc"); # use some form of this for i18n support +include_once("aur.inc"); # access AUR common functions +include_once("pkgfuncs.inc"); # use some form of this for i18n support set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in html_header(); # print out the HTML header diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index a3394af..0f7b449 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -1,13 +1,13 @@ <?php set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("config.inc"); +include_once("config.inc"); -require('Archive/Tar.php'); -require('Find.php'); +require_once('Archive/Tar.php'); +require_once('Find.php'); -include("aur.inc"); # access AUR common functions -include("pkgfuncs.inc"); # package functions +include_once("aur.inc"); # access AUR common functions +include_once("pkgfuncs.inc"); # package functions set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in diff --git a/web/html/rpc.php b/web/html/rpc.php index dc3d20b..399c9ad 100644 --- a/web/html/rpc.php +++ b/web/html/rpc.php @@ -2,8 +2,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); -include("aurjson.class.php"); +include_once("aurjson.class.php"); if ( $_SERVER['REQUEST_METHOD'] == 'GET' ) { if ( isset($_GET['type']) ) { diff --git a/web/html/rss2.php b/web/html/rss2.php index 499450b..ef6b2e7 100644 --- a/web/html/rss2.php +++ b/web/html/rss2.php @@ -2,9 +2,9 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang'); -include("aur.inc"); +include_once("aur.inc"); -include("feedcreator.class.php"); +include_once("feedcreator.class.php"); #If there's a cached version <1hr old, won't regenerate now $rss = new UniversalFeedCreator(); diff --git a/web/html/tu.php b/web/html/tu.php index 7634b64..c054b3b 100644 --- a/web/html/tu.php +++ b/web/html/tu.php @@ -2,7 +2,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); -include("aur.inc"); +include_once("aur.inc"); set_lang(); check_sid(); html_header(); diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index daa785f..29fc424 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -4,11 +4,12 @@ * * This file contains the AurRPC remote handling class **/ -if (!extension_loaded('json')) -{ +if (!extension_loaded('json')) { dl('json.so'); } +include_once("aur.inc"); + /** * This class defines a remote interface for fetching data * from the AUR using JSON formatted elements. -- 1.6.4
participants (1)
-
Dan McGee