From 4cdaae9278e293a5e79009d1065af0d930003879 Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 09:41:41 +0100 Subject: [PATCH 1/7] Skip ".svn" folders in libraries/rules/htmlindexes.php --- .../components/com_jedchecker/libraries/rules/htmlindexes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/administrator/components/com_jedchecker/libraries/rules/htmlindexes.php b/source/administrator/components/com_jedchecker/libraries/rules/htmlindexes.php index 9480c41..7ccd7ac 100644 --- a/source/administrator/components/com_jedchecker/libraries/rules/htmlindexes.php +++ b/source/administrator/components/com_jedchecker/libraries/rules/htmlindexes.php @@ -88,6 +88,8 @@ class jedcheckerRulesHtmlindexes extends JEDcheckerRule $path = $start; } else if ($file->isDot()) { continue; + } else if ($file->getFileName() == '.svn') { + continue; } $this->folders[$path] = true; @@ -106,4 +108,4 @@ class jedcheckerRulesHtmlindexes extends JEDcheckerRule } } } -} \ No newline at end of file +} From cc1a81c3871565063327cb634594784a5fed5480 Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 09:54:55 +0100 Subject: [PATCH 2/7] Add support tmp/com_jedchecked/local.txt to police-inventory --- .../com_jedchecker/controllers/police.raw.php | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/source/administrator/components/com_jedchecker/controllers/police.raw.php b/source/administrator/components/com_jedchecker/controllers/police.raw.php index ba65bd3..6f2bc35 100644 --- a/source/administrator/components/com_jedchecker/controllers/police.raw.php +++ b/source/administrator/components/com_jedchecker/controllers/police.raw.php @@ -31,9 +31,19 @@ class jedcheckerControllerPolice extends JControllerlegacy return false; } + // Loop through each folder and police it + $folders = $this->getFolders(); + foreach ($folders as $folder) { + $this->police($class, $folder); + } + + return true; + } + + protected function police($class, $folder) + { // Prepare rule properties - $folders = JFolder::folders($path); - $properties = array('basedir' => $path.'/'.$folders[0]); + $properties = array('basedir' => $folder); // Create instance of the rule $police = new $class($properties); @@ -49,5 +59,45 @@ class jedcheckerControllerPolice extends JControllerlegacy . ' - '. JText::_($police->get('title')) . '
' . $report->getHTML(); + + flush(); + ob_flush(); + } + + protected function getFolders() + { + $folders = array(); + + // Add the folders in the "jed_checked/unzipped" folder + $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; + $tmp_folders = JFolder::folders($path); + if (!empty($tmp_folders)) { + foreach ($tmp_folders as $tmp_folder) { + $folders[] = $path.'/'.$tmp_folder; + } + } + + // Parse the local.txt file and parse it + $local = JFactory::getConfig()->get('tmp_path') . '/com_jedchecker/local.txt'; + if (JFile::exists($local)) { + $content = JFile::read($local); + if (!empty($content)) { + $lines = explode("\n", $content); + if (!empty($lines)) { + foreach ($lines as $line) { + $line = trim($line); + if (!empty($line)) { + if (JFolder::exists(JPATH_ROOT.'/'.$line)) { + $folders[] = JPATH_ROOT.'/'.$line; + } elseif (JFolder::exists($line)) { + $folders[] = $line; + } + } + } + } + } + } + + return $folders; } } From e10f9965004bfe32497e116088c47c26b9fc79eb Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 10:04:49 +0100 Subject: [PATCH 3/7] Implemented tmp/jed_checker/local.txt file --- .../com_jedchecker/controllers/police.raw.php | 2 +- .../com_jedchecker/views/uploads/view.html.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source/administrator/components/com_jedchecker/controllers/police.raw.php b/source/administrator/components/com_jedchecker/controllers/police.raw.php index 6f2bc35..ba08fd0 100644 --- a/source/administrator/components/com_jedchecker/controllers/police.raw.php +++ b/source/administrator/components/com_jedchecker/controllers/police.raw.php @@ -78,7 +78,7 @@ class jedcheckerControllerPolice extends JControllerlegacy } // Parse the local.txt file and parse it - $local = JFactory::getConfig()->get('tmp_path') . '/com_jedchecker/local.txt'; + $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; if (JFile::exists($local)) { $content = JFile::read($local); if (!empty($content)) { diff --git a/source/administrator/components/com_jedchecker/views/uploads/view.html.php b/source/administrator/components/com_jedchecker/views/uploads/view.html.php index 91da64b..d8e4f21 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/view.html.php +++ b/source/administrator/components/com_jedchecker/views/uploads/view.html.php @@ -42,7 +42,7 @@ class jedcheckerViewUploads extends JViewLegacy JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); } if($this->filesExist('unzipped')) { - JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false); + JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'Check', false); } JToolBarHelper::title('JED checker'); @@ -53,14 +53,23 @@ class jedcheckerViewUploads extends JViewLegacy * @param $type * @return bool */ - private function filesExist($type) { + private function filesExist($type) + { $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/'.$type; + + // Check for the existence of files jimport('joomla.filesystem.folder'); if(JFolder::exists($path)) { if(JFolder::folders($path, '.', false) || JFolder::files($path, '.', false)) { return true; } + + } else { + $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; + if ($type == 'unzipped' && JFile::exists($local)) { + return true; + } } return false; } -} \ No newline at end of file +} From 879498d54e7daaa117d525496f797a2009e1fc3f Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 10:13:00 +0100 Subject: [PATCH 4/7] Moved README to markdown version Added instructions for new local.txt procedure --- README | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 3dec29f..0000000 --- a/README +++ /dev/null @@ -1,16 +0,0 @@ -JEDchecker - -This extension is able to check your components, modules or plugins for common errors that will prevent you -from publishing your extension on the JED. - -If you want to write a rule have a look a the library/rules folder. - -You just need to add a new file with your rule. Example: -yourrule.php - -"yourrule.php" needs to have a class jedcheckerRulesYourrule and that class needs to have a -function that accepts the basedir as parameter. This is all - the component will automatically call -your rule check function. - -ZIP packages for installation in joomla can be found here: -https://compojoom.com/downloads/official-releases-stable/jedchecker \ No newline at end of file From 0335663a4d393e759f239309a7645a8ce96adf61 Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 10:13:48 +0100 Subject: [PATCH 5/7] New README.md --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..51db53a --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +JEDchecker +========== + +This extension is able to check your components, modules or plugins for common errors that will prevent you +from publishing your extension on the JED (Joomla! Extensions Directory). + +Installing this extension +------------------------- +ZIP packages for installation in joomla can be found here: +https://compojoom.com/downloads/official-releases-stable/jedchecker + +Alternatively, download the sources of this repository and use Phing to build the packages. + +Uploading your package +---------------------- +After installing this extension in your Joomla! backend, you can use it by uploading a Joomla! extension-package using +the upload-button. Once uploaded, the contents of the package (your files) will be checked against JED-rules. + +Adding rules +------------ +If you want to write a rule have a look a the library/rules folder. + +You just need to add a new file with your rule. Example: +yourrule.php + +"yourrule.php" needs to have a class jedcheckerRulesYourrule and that class needs to have a +function that accepts the basedir as parameter. This is all - the component will automatically call +your rule check function. + +Checking on existing files and folders +-------------------------------------- +The extension also supports a scan of a pre-defined set of existing files and folders. +For this to work, add a list of folders to a textfile tmp/jed_checker/local.txt. +There should be a folder on each line. +Once the file exists, a "Check" button becomes visible in the jedchecker-toolbar. Just hit it. + +Example "tmp/jed_checker/local.txt" file: + components/com_weblinks + administrator/components/com_weblinks + plugins/system + From a9ee0c54077cf7a1b35f64b4c3c5e9fbbe80e4af Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 10:15:13 +0100 Subject: [PATCH 6/7] Used quotes for code --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 51db53a..6acda1f 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,11 @@ the upload-button. Once uploaded, the contents of the package (your files) will Adding rules ------------ -If you want to write a rule have a look a the library/rules folder. +If you want to write a rule have a look a the `administrator/components/com_jedchecker/library/rules` folder. -You just need to add a new file with your rule. Example: -yourrule.php +You just need to add a new file with your rule, for example `yourrule.php`. -"yourrule.php" needs to have a class jedcheckerRulesYourrule and that class needs to have a +The file `yourrule.php` needs to have a class `jedcheckerRulesYourrule` and that class needs to have a function that accepts the basedir as parameter. This is all - the component will automatically call your rule check function. From 5325df22362477d27f067c0ece0c77fcd8e164fb Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Tue, 12 Feb 2013 10:17:25 +0100 Subject: [PATCH 7/7] Code indenting --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6acda1f..d837df0 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,14 @@ your rule check function. Checking on existing files and folders -------------------------------------- The extension also supports a scan of a pre-defined set of existing files and folders. -For this to work, add a list of folders to a textfile tmp/jed_checker/local.txt. +For this to work, add a list of folders to a textfile `tmp/jed_checker/local.txt`. There should be a folder on each line. Once the file exists, a "Check" button becomes visible in the jedchecker-toolbar. Just hit it. -Example "tmp/jed_checker/local.txt" file: - components/com_weblinks - administrator/components/com_weblinks - plugins/system +Example `tmp/jed_checker/local.txt` file: + + components/com_weblinks + administrator/components/com_weblinks + plugins/system +