[ticket/331] Remove spellchecker
This commit is contained in:
@@ -60,7 +60,6 @@ script:
|
||||
- sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION; fi"
|
||||
- ../board3/Board3-Portal/travis/run-testsuite.sh $DB $TRAVIS_PHP_VERSION
|
||||
- sh -c "if [ '$EPV' != '0' ]; then ../board3/Board3-Portal/travis/run-epv.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"
|
||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' -a '$SPELLCHECK' != '0' ]; then php ../board3/Board3-Portal/develop/spellchecker.php; fi"
|
||||
|
||||
after_script:
|
||||
- sh -c "if [ '$COVERALLS' != '0' ]; then ../board3/Board3-Portal/travis/run-coveralls.sh $DB $TRAVIS_PHP_VERSION; fi"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2014 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
* This file checks the spelling in language files.
|
||||
*/
|
||||
|
||||
$root_path = dirname(__FILE__) . '/../';
|
||||
|
||||
$spellings = json_decode(file_get_contents($root_path . 'develop/misspellings.json'), true);
|
||||
$spellings_de = json_decode(file_get_contents($root_path . 'develop/misspellings_de.json'), true);
|
||||
$output = '';
|
||||
|
||||
// Cycle through all files
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root_path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($iterator as $file_info)
|
||||
{
|
||||
$file_path = $file_info->getPath();
|
||||
$file = $file_info->getFilename();
|
||||
if ($file === 'spellchecker.php' || strpos(realpath($file_path), 'board3/portal/develop') !== false || strpos(realpath($file_path), 'board3/portal/vendor') !== false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_exists($file_path . '/' . $file) && preg_match('/.+\.(?:(php))$/', $file))
|
||||
{
|
||||
$content = file_get_contents($file_path . '/' . $file);
|
||||
if (!empty($content))
|
||||
{
|
||||
// English files and php files
|
||||
if (!preg_match('/(?:(\/language\/de))/', $file_path))
|
||||
{
|
||||
$found_misspellings = array();
|
||||
foreach ($spellings as $misspell => $correct)
|
||||
{
|
||||
if (preg_match('/\b(?:(' . $misspell . '))\b/', $content) != false)
|
||||
{
|
||||
$found_misspellings[$misspell] = $correct;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($found_misspellings))
|
||||
{
|
||||
$lines = file($file_path . '/' . $file);
|
||||
|
||||
foreach ($spellings as $misspell => $correct)
|
||||
{
|
||||
if (!isset($found_misspellings[$misspell]))
|
||||
{
|
||||
$continue;
|
||||
}
|
||||
|
||||
foreach ($lines as $line_no => $line)
|
||||
{
|
||||
if (preg_match('/\b(?:(' . $misspell . '))\b/', $line) != false)
|
||||
{
|
||||
$output .= "Found misspelling \"$misspell\" in " . realpath($file_path) . "/$file at Line $line_no<br />Should probably be: $correct<br /><br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$found_misspellings = array();
|
||||
foreach ($spellings_de as $misspell => $correct)
|
||||
{
|
||||
if (preg_match('/\b(?:(' . $misspell . '))\b/', $content) != false)
|
||||
{
|
||||
$found_misspellings[$misspell] = $correct;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($found_misspellings))
|
||||
{
|
||||
$lines = file($file_path . '/' . $file);
|
||||
|
||||
foreach ($spellings_de as $misspell => $correct)
|
||||
{
|
||||
if (!isset($found_misspellings[$misspell]))
|
||||
{
|
||||
$continue;
|
||||
}
|
||||
|
||||
foreach ($lines as $line_no => $line)
|
||||
{
|
||||
if (preg_match('/\b(?:(' . $misspell . '))\b/', $line) != false)
|
||||
{
|
||||
$output .= "Found misspelling \"$misspell\" in " . realpath($file_path) . "/$file at Line $line_no<br />Should probably be: $correct<br /><br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
{
|
||||
$output = str_replace('<br />', "\n", $output);
|
||||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
// Exit with 1 if script encountered issues
|
||||
if (strlen($output) > 0)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("Done. Tests passed." . ((PHP_SAPI == 'cli') ? "\n" : '<br />'));
|
||||
}
|
||||
Reference in New Issue
Block a user