Giter Site home page Giter Site logo

Unable to remove theme about grav-plugin-admin HOT 41 CLOSED

PSiAU avatar PSiAU commented on August 18, 2024
Unable to remove theme

from grav-plugin-admin.

Comments (41)

flaviocopes avatar flaviocopes commented on August 18, 2024

I cannot reproduce it, what's your server setup?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

My setup is as follows. I know it can be optimised with other components like php-fpm but i'm happy with it for dev work.
Debian 7.8
Apache 2.2
PHP 5.4 running as mod_php

Apache runs as www-data. Grav is installed in /var/www/html/grav01, running from the default docroot to keep things simple (no named vhost). That entire directory and everything under it is owned by www-data (user and group).
All components have been installed from the official apt repos.
It's a very simple setup, nothing complicated (IMHO) about it.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Is the theme symlinked, or you just installed it through the admin?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

I installed it through the admin.
It's a completely fresh install of Grav 0.9.35, with the admin plugin installed first, followed by Theme installation and attempted removal. Nothing else was done to it.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Strange, I just recreated the process you followed but all works fine. Let's wait if @rhukster has ideas of what could be

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Thanks for looking at it @flaviocopes
Something which may or may not be related is when I click on an installed but unactivated theme, there is a Save button in the top right corner. Upon clicking it throws the error "Validation failed: enabled is not defined in blueprints".

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

That is going to be fixed in the next round of theme releases, it's already fixed in the themes repositories - got the same error on save, but the uninstall works fine.

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

Hmm. i can't replicate this also. I really am not sure what it could be other than permissions.

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

can you for testing purposes set the theme to be 777 and see if you can delete via the admin? This will rule out permissions being the issue

$ chmod -R 777 themename/

Cheers.

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Nope, didn't help :(

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

ok, well that actually helps. One other thing, I'm sure the GPM command from the console to remove the theme doesn't work either?

$ bin/gpm uninstall yourtheme

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

That actually worked!

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

Oh ok, then we definitely have narrowed it down to the admin plugin then. That will help. I'll see if flavio can take a look tomorrow morning his time.

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Awesome. Thanks for taking the time to look into it :)

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

@PSiAU can you add this line

var_dump($target); var_dump(is_dir($target)); var_dump(is_file($target)); var_dump(file_exists($target)); exit();

to system/src/Grav/Common/Filesystem/Folder.php, before line 246? In short, before the highlighted line here: https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Filesystem/Folder.php#L246

Then try to remove the theme again, and let me know what's the output you get in the page.

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Sure thing. This is the result:
bool(false) bool(false) bool(false) bool(false)

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Strange! It seems it cannot even find the theme folder. Can you put in this line https://github.com/getgrav/grav-plugin-admin/blob/develop/classes/gpm.php#L130

var_dump($location); var_dump(Installer::lastErrorCode()); exit();

And tell me the output?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

This is the result:
bool(false) int(4)

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Uhm.... replace that same line with

var_dump($package->package_type); var_dump($package->slug); exit();

I get, when deleting Afterburner2:

string(6) "themes" string(12) "Afterburner2". You?

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

I didn't ask, but which browser are you using?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

This is what I get:
string(6) "themes" string(6) "Agency"

I'm using Safari 8, but I've also tried this with Chrome 44 and it does the same thing.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Really strange. Removing any plugin from the admin-side works fine, or same issue?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

I hadn't tried that before......so I just gave it a shot then (removed the Email plugin), and i get a runtime exception:
One of the required plugins is missing or not enabled

Open: /var/www/grav01/user/plugins/admin/admin.php
            'onTask.GPM'          => ['onTaskGPM', 0]
        ]);

        // Check for required plugins
        if (!$this->grav['config']->get('plugins.login.enabled') ||
            !$this->grav['config']->get('plugins.form.enabled') ||
            !$this->grav['config']->get('plugins.email.enabled')) {
            throw new \RuntimeException('One of the required plugins is missing or not enabled');
        }

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Haha that's actually killed my whole admin panel.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Ah that's actually because it's required by the admin plugin (should put up a warning prior to delete a plugin with dependencies). Reinstall it using bin/gpm. What about a "normal" plugin, for example Feed?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

After a fresh install and installing the Feed plugin, I was able to successfully disable it, but not uninstall it. It gave the same error:
Cannot delete non-existing folder.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Tracked it down to Locator::findResource() not finding plugins or themes during uninstall. @rhukster any ideas what could it be, maybe the Streams config not being setup properly?

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

It just makes no sense that it works for everyone else, but not for one person. Is it possible to try a newer version of PHP? I've tested 5.4.43 at it seems to work fine. But 5.5 or 5.6 would be even better.

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

Also can you compare the CLI version of PHP to your Apache/webserver version:

$ php -v

and:

info.php

<? phpinfo();

Point your browser at http://localhost/info.php

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Both versions match: PHP 5.4.41-0+deb7u1
I also tried disabling Zend OPcache 7.0.5 just in case it could have contributed to the problem (trying everything at this stage) but no it didn't help either.

I'll try running it on Debian 8 later and see if that makes a difference.

from grav-plugin-admin.

rhukster avatar rhukster commented on August 18, 2024

I'm running out of ideas! :) Just to confirm:

  1. you can install via admin and gpm
  2. you can list via admin and gpm
  3. you can uninstall via gpm, but not admin

That correct?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Yup! That about sums it up.
I really hope it's not just me doing something wrong, i'd feel like a right fool otherwise.

from grav-plugin-admin.

w00fz avatar w00fz commented on August 18, 2024

What makes this weird is that it looks like it's a stream issue, but you are able to list all plugins and themes which are using the same stream. Plus you can even delete via CLI and GPM.

Could you try editing the file system/src/Grav/Common/Filesystem/Folder.php, line 246 and make it:

var_dump('target', $target, 'is_dir', is_dir($target)); die;
if (!is_dir($target)) {

Then post here what you get?

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

This is the result:
string(6) "target" bool(false) string(6) "is_dir" bool(false)

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

I just setup a completely new Debian 8 VM with the following components:
Apache 2.4
PHP 5.6 running as mod_php

The same thing is happening :(

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Good news! Replicated on a shared hosting. I'll test directly there.

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

Really glad to hear that! Thanks so much for keeping at it.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Fixed by getgrav/grav@42e6d58

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

Ok @PSiAU it was a simple fix in the end, once I got to the head of the problem!

You can install the latest Grav source from https://github.com/getgrav/grav or just apply the fix getgrav/grav@42e6d58, or just wait for the next Grav update to contain the fix :)

Thanks for your patience in solving this!

from grav-plugin-admin.

PSiAU avatar PSiAU commented on August 18, 2024

no that YOU @flaviocopes :)
I manually patched the file and can confirm it's fixed the problem.

from grav-plugin-admin.

flaviocopes avatar flaviocopes commented on August 18, 2024

πŸŽ‰

from grav-plugin-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.