Skip to content

Commit

Permalink
Remove installation app from most checkstyle exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Mar 5, 2013
1 parent 78dd5b5 commit 1981b2a
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 40 deletions.
16 changes: 6 additions & 10 deletions build/phpcs/Joomla/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@

<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Files.LineLength">
<!-- We only want this for cli for now -->
<!-- These exceptions are temporary -->
<exclude-pattern>/administrator/*</exclude-pattern>
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/libraries/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
<!-- These exceptions are permanent -->
<exclude-pattern>*/tmpl/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
<exclude-pattern>/layouts/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
<exclude-pattern>/installation/template/index.php</exclude-pattern>
</rule>
<rule ref="Zend.Files.ClosingTag">
<exclude-pattern>*/tmpl/*</exclude-pattern>
Expand Down Expand Up @@ -102,6 +104,7 @@
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
<exclude-pattern>/layouts/*</exclude-pattern>
<exclude-pattern>*/tmpl/*</exclude-pattern>
</rule>

<!-- Lines can be 85 chars long, but never show errors -->
Expand Down Expand Up @@ -131,7 +134,6 @@
<exclude-pattern>/administrator/*</exclude-pattern>
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
</rule>

<rule ref="Joomla.Commenting.FunctionComment">
Expand All @@ -140,7 +142,6 @@
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
<exclude-pattern>/layouts/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
Expand All @@ -152,7 +153,6 @@
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
<exclude-pattern>/layouts/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
Expand All @@ -172,7 +172,6 @@
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
<exclude-pattern>/layouts/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
Expand All @@ -184,7 +183,6 @@
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<exclude-pattern>/includes/*</exclude-pattern>
<!-- These exceptions are permanent -->
<exclude-pattern>*/tmpl/*</exclude-pattern>
Expand All @@ -197,7 +195,6 @@
<!-- These exceptions are temporary -->
<exclude-pattern>/administrator/components/*</exclude-pattern>
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<!-- These exceptions are permanent -->
<exclude-pattern>*/tmpl/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
Expand All @@ -211,7 +208,6 @@
<exclude-pattern>/components/*</exclude-pattern>
<exclude-pattern>/plugins/*</exclude-pattern>
<exclude-pattern>/modules/*</exclude-pattern>
<exclude-pattern>/installation/*</exclude-pattern>
<!-- These exceptions are permanent -->
<exclude-pattern>*/tmpl/*</exclude-pattern>
<exclude-pattern>/templates/*</exclude-pattern>
Expand Down
4 changes: 3 additions & 1 deletion installation/application/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
* Check if a configuration file already exists.
*/

if (file_exists(JPATH_CONFIGURATION . '/configuration.php') && (filesize(JPATH_CONFIGURATION . '/configuration.php') > 10) && !file_exists(JPATH_INSTALLATION . '/index.php'))
if (file_exists(JPATH_CONFIGURATION . '/configuration.php')
&& (filesize(JPATH_CONFIGURATION . '/configuration.php') > 10)
&& !file_exists(JPATH_INSTALLATION . '/index.php'))
{
header('Location: ../index.php');
exit();
Expand Down
4 changes: 2 additions & 2 deletions installation/application/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public function getLocalise()
* Returns the installed language files in the administrative and
* front-end area.
*
* @param boolean $db
* @param mixed $db JDatabaseDriver instance
*
* @return array Array with installed language packs in admin and site area
*
Expand Down Expand Up @@ -472,7 +472,7 @@ protected function initialiseApp($options = array())
{
$sessionOptions = $this->getSession()->get('setup.options');

if (isset($sessionOptions['language']));
if (isset($sessionOptions['language']))
{
$options['language'] = $sessionOptions['language'];
}
Expand Down
19 changes: 11 additions & 8 deletions installation/controller/removefolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ public function execute()
}
else
{

// Try to delete the folder.
// We use output buffering so that any error message echoed JFolder::delete
// doesn't land in our JSON output.
/*
* Try to delete the folder.
* We use output buffering so that any error message echoed JFolder::delete
* doesn't land in our JSON output.
*/
ob_start();
$return = JFolder::delete($path) && (!file_exists(JPATH_ROOT . '/joomla.xml') || JFile::delete(JPATH_ROOT . '/joomla.xml'));
ob_end_clean();
Expand All @@ -108,8 +109,10 @@ public function execute()
$r = new stdClass;
$r->text = JText::_('INSTL_COMPLETE_FOLDER_REMOVED');

// Send the response
// This is a hack since by now, the rest of the folder is deleted and we can't make a new request
/*
* Send the response
* This is a hack since by now, the rest of the folder is deleted and we can't make a new request
*/
$this->sendJsonResponse($r);
}

Expand Down Expand Up @@ -156,9 +159,9 @@ class InstallationResponseJson
/**
* Constructor for the JSON response
*
* @param mixed $data Exception if there is an error, otherwise, the session data
* @param mixed $data Exception if there is an error, otherwise, the session data
*
* @since 3.1
* @since 3.1
*/
public function __construct($data)
{
Expand Down
3 changes: 2 additions & 1 deletion installation/controller/setlanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function execute()
$app->setHeader('status', 500);
$app->setHeader('Content-Type', 'application/json; charset=utf-8');
$app->sendHeaders();
echo '{"token":"' . JSession::getFormToken(true) . '","lang":"' . JFactory::getLanguage()->getTag() . '","error":true,"header":"' . JText::_('INSTL_HEADER_ERROR') . '","message":"' . JText::_('INSTL_WARNJSON') . '"}';
echo '{"token":"' . JSession::getFormToken(true) . '","lang":"' . JFactory::getLanguage()->getTag()
. '","error":true,"header":"' . JText::_('INSTL_HEADER_ERROR') . '","message":"' . JText::_('INSTL_WARNJSON') . '"}';
$app->close();
}

Expand Down
14 changes: 9 additions & 5 deletions installation/helper/html/installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ public static function stepbarlanguages()
}

/**
* @param string $id
* @param array $tabs
* Method to generate the navigation tab
*
* @param string $id The container ID
* @param array $tabs The navigation tabs
*
* @return string Markup for the tab
*
Expand Down Expand Up @@ -107,10 +109,12 @@ private static function getTab($id, $tabs)
}

/**
* @param string $id
* @param array $tabs
* Method to determine the tab (step) number
*
* @param string $id The container ID
* @param array $tabs The navigation tabs
*
* @return int
* @return integer Tab number in navigation sequence
*
* @since 3.1
*/
Expand Down
23 changes: 15 additions & 8 deletions installation/model/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ protected static function generateRandUserId()
}

/**
* Resets the user ID
*
* @return void
*
* @since 3.1
*/
public static function resetRandUserId()
Expand Down Expand Up @@ -156,7 +160,9 @@ public function initialise($options)
// Get a database object.
try
{
return InstallationHelperDatabase::getDbo($options->db_type, $options->db_host, $options->db_user, $options->db_pass, $options->db_name, $options->db_prefix, $options->db_select);
return InstallationHelperDatabase::getDbo(
$options->db_type, $options->db_host, $options->db_user, $options->db_pass, $options->db_name, $options->db_prefix, $options->db_select
);
}
catch (RuntimeException $e)
{
Expand Down Expand Up @@ -271,7 +277,7 @@ public function createDatabase($options)

$options = (array) $options;

// remove *_errors value
// Remove *_errors value
foreach ($options as $i => $option)
{
if (isset($i['1']) && $i['1'] == '*')
Expand All @@ -294,7 +300,7 @@ public function createDatabase($options)
/**
* Method to process the old database
*
* @param $options array The options array
* @param array $options The options array
*
* @return boolean True on success
*
Expand Down Expand Up @@ -343,7 +349,7 @@ public function handleOldDatabase($options)
/**
* Method to create the database tables
*
* @param $options array The options array
* @param array $options The options array
*
* @return boolean True on success
*
Expand Down Expand Up @@ -553,7 +559,7 @@ public function createTables($options)
/**
* Method to install the sample data
*
* @param array $options
* @param array $options The options array
*
* @return boolean True on success
*
Expand Down Expand Up @@ -880,9 +886,10 @@ protected function _splitQueries($sql)
// Remove PostgreSQL comment lines.
$sql = preg_replace("/\n\--[^\n]*/", '', "\n" . $sql);

// find function
// Find function
$funct = explode('CREATE OR REPLACE FUNCTION', $sql);
// save sql before function and parse it

// Save sql before function and parse it
$sql = $funct[0];

// Parse the schema file to break up queries.
Expand Down Expand Up @@ -916,7 +923,7 @@ protected function _splitQueries($sql)
$queries[] = $sql;
}

// add function part as is
// Add function part as is
for ($f = 1; $f < count($funct); $f++)
{
$queries[] = 'CREATE OR REPLACE FUNCTION ' . $funct[$f];
Expand Down
7 changes: 6 additions & 1 deletion installation/model/fields/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ protected function getOptions()
/**
* Method to sort languages by name.
*
* @since 3.1
* @param string $a The first value to determine sort
* @param string $b The second value to determine sort
*
* @return string
*
* @since 3.1
*/
protected function _sortLanguages($a, $b)
{
Expand Down
2 changes: 1 addition & 1 deletion installation/model/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getOptions()
/**
* Store the current setup options in the session.
*
* @param array $options
* @param array $options The installation options
*
* @return array An array of options from the session
*
Expand Down
4 changes: 2 additions & 2 deletions installation/response/json.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class InstallationResponseJson
/**
* Constructor for the JSON response
*
* @param mixed $data Exception if there is an error, otherwise, the session data
* @param mixed $data Exception if there is an error, otherwise, the session data
*
* @since 3.1
* @since 3.1
*/
public function __construct($data)
{
Expand Down
2 changes: 1 addition & 1 deletion installation/view/summary/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="controls">
<?php echo $this->form->getInput('summary_email'); ?>
<p class="help-block">
<?php echo JText::sprintf('INSTL_SUMMARY_EMAIL_DESC', '<span class="label">'.$this->options['admin_email'].'</span>'); ?>
<?php echo JText::sprintf('INSTL_SUMMARY_EMAIL_DESC', '<span class="label">' . $this->options['admin_email'] . '</span>'); ?>
</p>
</div>
</div>
Expand Down

0 comments on commit 1981b2a

Please sign in to comment.