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

Unable to (re)set tinyint values to 0 #411

Open
hugopeek opened this issue Nov 10, 2022 · 0 comments
Open

Unable to (re)set tinyint values to 0 #411

hugopeek opened this issue Nov 10, 2022 · 0 comments

Comments

@hugopeek
Copy link
Contributor

Summary

When extracting a tinyint field with value 0, the line is not included in the YAML file. I think this happens with other 0 / empty values too, so that's not necessarily the problem.. But in this case, the value is not being (re)set to 0 on build.

Step to reproduce

  • Login to a MODX install with Gitify configured and at least 1 plugin.
  • Disable the plugin and extract
gitify extract plugins
git diff _data/plugins/ClientConfig.php 

You should see the added line for disabled:

diff --git a/_data/plugins/ClientConfig.php b/_data/plugins/ClientConfig.php
index a51d7db..dd5e904 100644
--- a/_data/plugins/ClientConfig.php
+++ b/_data/plugins/ClientConfig.php
@@ -1,7 +1,8 @@
 id: 100013
 name: ClientConfig
 description: 'Sets system settings from the Client Config CMP.'
-properties: null
+properties: 'a:0:{}'
+disabled: 1

Now, either reset the YAML file or enable the plugin again in MODX, extract, and then disable again. The disabled line is now removed from the extract again.

Observed behavior

Build and behold: the plugin is still disabled!

I'm currently experiencing this with multiple fields, mostly in custom tables. All are tinyint.

In the SQL schema, the fields often have a default value of 0. Maybe that's why they're not being extracted?

<field key="disabled" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="0" index="index" />

Expected behavior

The plugin should be enabled again, as disabled: 1 is no longer present.

Environment

Gitify 2.0.0-alpha3
MODX 2.8.4
MariaDB 10.6
PHP 8.1

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

1 participant