Skip to content

Adding datastore2json & json2datastore scripts#2053

Open
Lucas-C wants to merge 1 commit intoshaarli:masterfrom
Lucas-C:datastore2json
Open

Adding datastore2json & json2datastore scripts#2053
Lucas-C wants to merge 1 commit intoshaarli:masterfrom
Lucas-C:datastore2json

Conversation

@Lucas-C
Copy link
Copy Markdown

@Lucas-C Lucas-C commented Dec 4, 2023

This is a follow-up on a previous PR: #1823

I made sure that the script works with the latest version of Shaarli,
and added the "inverse" script, that convert from JSON to a datastore.php file.

Usage:

composer datastore2json > datastore.json
composer json2datastore datastore.json > data/datastore.php

Or:

php -f datastore2json > datastore.json
php -f json2datastore datastore.json > data/datastore.json

@Lucas-C Lucas-C changed the title Adding datastore2json script Adding datastore2json & json2datastore scripts Dec 4, 2023
@Lucas-C
Copy link
Copy Markdown
Author

Lucas-C commented Dec 5, 2023

To give some context, in my usage of Shaarli, those scripts serve as a base to perform several operations on all my bookmarks:

  • remove a tag from all bookmarks
  • replace a tag by one or several others in all bookmarks
  • perform a regex-based substitution in the descriptions of all bookmarks

@nodiscc nodiscc added this to the backlog to the future milestone Nov 15, 2024
@nodiscc nodiscc removed the in review label May 1, 2025
@SansGuidon
Copy link
Copy Markdown

This would be awesome.

@nodiscc nodiscc modified the milestones: backlog to the future, 0.15.0 May 28, 2025
@nodiscc nodiscc modified the milestones: 0.15.0, 0.16.0 Jun 11, 2025
@Lucas-C Lucas-C force-pushed the datastore2json branch 2 times, most recently from aa2582e to 2a931ff Compare December 12, 2025 12:59
@nodiscc nodiscc modified the milestones: 0.16.0, 0.17.0 Jan 24, 2026
@nodiscc
Copy link
Copy Markdown
Member

nodiscc commented Mar 22, 2026

@Lucas-C sorry for the delay
I don't really want to maintain this in the main shaarli repository
If these scripts work, would you like to maintain them in your own repository?
Then we could link it from https://shaarli.readthedocs.io/en/master/Community-and-related-software.html

@Lucas-C
Copy link
Copy Markdown
Author

Lucas-C commented Mar 23, 2026

@Lucas-C sorry for the delay I don't really want to maintain this in the main shaarli repository If these scripts work, would you like to maintain them in your own repository? Then we could link it from https://shaarli.readthedocs.io/en/master/Community-and-related-software.html

Alright, I will do that and submit a PR to add my repo to this list 👍

@Lucas-C Lucas-C closed this Mar 23, 2026
@Lucas-C
Copy link
Copy Markdown
Author

Lucas-C commented Mar 23, 2026

On second thought: 2 changes to Shaarli application code are made in this PR in order for the json2datastore & json2datastore scripts to work: would you be open to adopt them in Shaarli code base?
They allow for easy JSON serialization of Shaarli links.

There are required for the json2datastore & json2datastore scripts to work.
And those changes cannot be "outsourced" to a distinct repository.

If you agree, I'll reduce the scope of this PR to just the changes to the application/bookmark/Bookmark.php & application/bookmark/BookmarkArray.php files.

@Lucas-C Lucas-C reopened this Mar 23, 2026
@Lucas-C
Copy link
Copy Markdown
Author

Lucas-C commented Mar 23, 2026

For now I initialized https://github.com/Lucas-C/shaarli-scripts

I'll wait for an answer here, and this PR to be merged, before fully testing the "externalized" datastore2json & json2datastore scripts, and submitting this repo onto https://shaarli.readthedocs.io/en/master/Community-and-related-software.html

@nodiscc nodiscc self-requested a review March 23, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants