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

Tasks vanish from task list #38

Open
babudro opened this issue Aug 21, 2017 · 3 comments
Open

Tasks vanish from task list #38

babudro opened this issue Aug 21, 2017 · 3 comments
Labels

Comments

@babudro
Copy link

babudro commented Aug 21, 2017

For the second time I have noticed tasks have disappeared from my task list. As I started looking through the wiki today to figure out why, another one suddenly disappeared from the list. The pages are there and still have the ~~TASK tag in them,.

The last time this happened I just copied the page and created a new page with a different name, copying-and-pasting exactly the same content, and it showed up again in the task list. I tried the same thing just now: Opened a page that is not showing, select-all, copy-all, create a new page, paste, then go back to the task list and, sure enough, it is there.

I tried clearing browser cache, opened the pages in SeaMonkey and IE as well as Firefox, re-installed the plug-in, and removed the data/meta/*.meta file and let it be re-generated. None of these made any difference. Rarely if I edit the page it has re-appeared in the list -- it happened with one today -- but usually it makes no difference.

I just tried removing the pagename.task file and re-loading a page that was not in the list and this put it back into the list. Doing a diff on the old and new .task files I see very little changed -- two timestamps in the first line, the CREATED nad LAST-MODIFIED lines, and a hex string in the last line.

I did a "tail -n1 *task" and looked at all those hex strings and I discovered that the ones that do not show up in the list have duplicated values in this last field:

==> authentication.task <==
";s:3:"key";s:10:"c496663560";}
==> audits_remaining.task <==
";s:3:"key";s:10:"c496663560";}

and

==> prep/oem.task <==
";s:3:"key";s:10:"a496656173";}
==> prep/test.task <==
";s:3:"key";s:10:"a496656173";}

I tried simply incrementing the value of one of the files by one and that made it appear in the list again. Is this a safe thing to do (not knowing what that last field is used for)? If so, I could write a script to look for duplicated values and change one of them every night (or even every hour).

Thanks.

@lpaulsen93 lpaulsen93 added the bug label Aug 22, 2017
@lpaulsen93
Copy link
Member

Sorry, this is a bug in the task plugin.

Until the bug is fixed, please try this workaround:

  • Open the file lib/plugins/task/helper.php
  • Starting at line 137 you should find the following code block:
            $result[$task['key']] = array(
                    'id'       => $id,
                    'date'     => $date,
                    'user'     => $task['user']['name'],
                    'status'   => $this->statusLabel($task['status']),
                    'priority' => $task['priority'],
                    'perm'     => $perm,
                    'file'     => $task['file'],
                    'exists'   => true,
                    );
  • Insert some lines in front of this code so that it looks like this:
            // Make sure the key is unique (but not more than 10 tries...
            // ...just a workaround for now)
            $max = 0;
            while (array_key_exists ($task['key'], $result)) {
                $task['key']++;
                $max++;
                if ($max > 10) {
                    break;
                }
            }

            $result[$task['key']] = array(
                    'id'       => $id,
                    'date'     => $date,
                    'user'     => $task['user']['name'],
                    'status'   => $this->statusLabel($task['status']),
                    'priority' => $task['priority'],
                    'perm'     => $perm,
                    'file'     => $task['file'],
                    'exists'   => true,
                    );
  • Save the file

This will automatically do what you did. It does not change the task page content but when the task list is build and the number is the same as for a already listed task page it will simply increasing the number by 1. If there is still another task page with the same number it is increasing it again and so on... after 10 tries it is giving up and in that case you again would lose a task page in the list. That is why this is just a workaround to help you quick.

By the way: a very good examination of the problem. Not sure if I would have found it myself 👍

Worked well for me, please test.

@lpaulsen93
Copy link
Member

@babudro: any news/feedback? Did this solve your problem?

@ekrister
Copy link

Hi, I just updated the tasks-plugin to the newest version and noticed this bug. My tasks didn't show up. The code above fixed it. Maybe include the code in the next release?

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

No branches or pull requests

3 participants