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

Undefined variable: plugin_folder in ... /plugins/Customizer/Plugin.php on line 128 #123

Closed
Blackrapier-muc opened this issue Mar 1, 2021 · 3 comments
Labels
working on it not a bug but needs to be added

Comments

@Blackrapier-muc
Copy link

After upgrading my Kanboard instance from 1.2.9 to the current 1.2.18, the following message always appears in the log:

2021/03/01 15:15:36 [error] 16776 # 16776: * 675 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: plugin_folder in /var/www/html/kanboard/plugins/Customizer/Plugin.php on line 128PHP message: PHP Notice: Undefined variable: plugin_folder in /var/www/html/kanboard/plugins/Customizer/Plugin.php on line 129 "while reading response header from upstream, client: *. * . *. *, server: xx.xxxxx.xxx, request: "GET/?controller=SoundNotificationController&action=soundNotifications&plugin=SoundNotification&_=1614608036365 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host:" xx.xxxxx.xxx

This error also occurs when accessing the TaskViewController, UserAjaxController or the BoardViewController

The following versions are installed on the server:
PHP version: 7.4.3
PHP SAPI: fpm-fcgi
HTTP client: cURL
Operating system version: Linux 5.4.0-66-generic
Database driver: MySQL
Database version: 10.3.25-MariaDB-0ubuntu0.20.04.1

Installed plugins:

  • AttachDocumentsforViewers
  • AutoSubtasks
  • Backlog
  • Bak2topbotm
  • Beanstalk
  • Board customizer
  • Calendar
  • CardPushDate
  • Coverimage
  • Creecros_Filter_Pack
  • Customizer (I'm using the latest GIT release)
  • Due date
  • ExtendedMail
  • Gantt
  • Group_assign
  • Group_owners
  • HighlightCodeSyntax
  • MarkdownPlus
  • Mattermost
  • MetaMagic
  • Milestone
  • MinimizeSidebar
  • Moon
  • OAuth2
  • SendEmailCreator
  • Signal
  • Slack
  • SoundNotification
  • StarredProjects
  • Subtask date
  • Task2pdf
  • TaskAssignCategory
  • TaskPushDate
  • Telegram
  • TimeMachine
  • Timetracking editor
  • UpdateNotifier
@eguaj
Copy link

eguaj commented Mar 1, 2021

I concur, I observed the same warning: the $plugin_folder is effectively not defined in the onStartup() method.

I fixed it by adding the $plugin_folder = basename(PLUGINS_DIR); directive as seen in the initialize() method:

--- Customizer/Plugin.php.orig  2021-02-10 14:18:24.000000000 +0100
+++ Customizer/Plugin.php       2021-03-01 16:11:05.921069209 +0100
@@ -123,6 +123,7 @@
   
     public function onStartup()
     {
+        $plugin_folder = basename(PLUGINS_DIR);
         Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
         $user_id = $this->customizerFileModel->getUserSessionId();
         $user_theme = $this->userMetadataModel->get($user_id, 'themeSelection', $this->configModel->get('themeSelection', $plugin_folder.'/Customizer/Assets/css/theme.css' ));

This missing $project_folder var was also throwing the following PHP Warning:

PHP Warning:  filemtime(): stat failed for /Customizer/Assets/css/theme.css in /.../kanboard/app/Helper/AssetHelper.php on line 37

I also had the following PHP Warning that I fixed by setting the ownership of the plugins/Customizer/Assets/css/userthemes to www-data (chown -R www-data: plugins/Customizer/Assets/css/userthemes):

PHP Warning:  unlink(plugins/Customizer/Assets/css/userthemes/.gitignore): Permission denied in /.../kanboard/plugins/Customizer/Plugin.php on line 30

@creecros
Copy link
Owner

creecros commented Mar 4, 2021

when I get a chance I can add it to the repo, unless you want to make a PR.

@creecros creecros added the working on it not a bug but needs to be added label Mar 8, 2021
creecros added a commit that referenced this issue Mar 8, 2021
@creecros creecros closed this as completed Mar 8, 2021
creecros added a commit that referenced this issue Mar 8, 2021
creecros added a commit that referenced this issue Mar 8, 2021
creecros added a commit that referenced this issue Mar 8, 2021
@creecros
Copy link
Owner

creecros commented Mar 8, 2021

@eguaj @Blackrapier-muc

Think this is all set now. Added plugin dir variable to onStartup(), and removed userthemes folder from inital folder structure, letting Customizer make the folder with 755 permissions and correct user, to avoid permissions issues in the future.

@creecros creecros mentioned this issue Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
working on it not a bug but needs to be added
Projects
None yet
Development

No branches or pull requests

3 participants