Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OC2: bug in admin/controller/extension/modification.php #1914

Closed
mhcwebdesign opened this issue Oct 3, 2014 · 2 comments
Closed

OC2: bug in admin/controller/extension/modification.php #1914

mhcwebdesign opened this issue Oct 3, 2014 · 2 comments

Comments

@mhcwebdesign
Copy link
Collaborator

The file has a bug in function 'clear', when calling rsort($files). $files is not always set, causing rsort to fail with an error. Suggested fix:

    public function clear() {
        $this->load->language('extension/modification');

        $this->document->setTitle($this->language->get('heading_title'));

        $this->load->model('extension/modification');

        if ($this->validate()) {
            // Make path into an array
            $path = array(DIR_MODIFICATION . '*');
            $files = array();

            // While the path array is still populated keep looping through
            while (count($path) != 0) {
                $next = array_shift($path);

                foreach (glob($next) as $file) {
                    // If directory add to path array
                    if (is_dir($file)) {
                        $path[] = $file . '/*';
                    }

                    // Add the file to the files to be deleted array
                    $files[] = $file;
                }
            }

            // Reverse sort the file array
            rsort($files);
            .....
@skyosev
Copy link
Contributor

skyosev commented Oct 4, 2014

All of the file removal logic can be trimmed down to three lines. See #1919

@danielkerr
Copy link
Member

yes your right but i really hate that class. its very ugly class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants