• 0 Votes
    7 Posts
    840 Views

    @pitaj Many thanks for your effort 🙏

    Okay so I just npm link'ed my plugin again so I thought some file will be updated. But they weren't.

    Here is my full source code of libary.js:

    'use strict'; /* NodeBB Basic Plugin Libraries */ const controllers = require('./lib/controllers'); const plugin = {}; /* Third Party Libraries */ const Discord = require("discord.js"); const fs = require("fs"); // Nodebb Discord Bot const config = JSON.parse(fs.readFileSync("./utils/config.json", "utf-8")); var client = new Discord.Client(); let debug = true; plugin.init = function (params, callback, client) { myDebug("nodebb-discord-bot-started"); callback(); }; function myDebug(msg){ if(debug){ console.log(msg); } } module.exports = plugin; 2021-01-12T10:46:19.318Z [4567/4689] - error: Error: ENOENT: no such file or directory, open './utils/config.json' at Object.openSync (fs.js:462:3) at Object.readFileSync (fs.js:364:35) at Object.<anonymous> (/home/ubuntu/nodebb-linked-modules/nodebb-plugin-makesmart-discord-bot/library.js:15:30) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.Plugins.requireLibrary (/home/ubuntu/nodebb/src/plugins/index.js:70:39)

    I tried it with path again:

    // Nodebb Discord Bot var configpath = path.join(__dirname, 'utils', 'config.json'); const config = JSON.parse(fs.readFileSync(configpath, "utf-8")); var client = new Discord.Client();

    an suddenly ... it worked! o.O

    2021-01-12T10:51:15.711Z [4567/4765] - info: [api] Adding 2 route(s) to `api/v3/plugins` 2021-01-12T10:51:15.889Z [4567/4765] - info: Routes added 2021-01-12T10:51:15.933Z [4567/4765] - info: NodeBB Ready 2021-01-12T10:51:15.943Z [4567/4765] - info: Enabling 'trust proxy' 2021-01-12T10:51:15.972Z [4567/4765] - info: NodeBB is now listening on: 0.0.0.0:4567

    I think it was really because I ran npm link again. Funny.* I'm sorry. Most of the time, the problem is in front of the computer. 🙄

    But still a strange behavior in my opinion. Well ... Good to know for the future. @PitaJ as mentioned thank you for you effort. 🙏

    For any others having the same issue:

    Read the Stackoverflow Solution posted by @PitaJ right here If it still not work use npm link in ./nodebb again to refresh something in the plugin folder ...I dont know tbh ... 😄
  • 1 Votes
    3 Posts
    910 Views

    Hope so! Seems like there's at least one other site using this port of phpbb. Perhaps more if they cleaned out the attribution footer markup or aren't indexed by google.

  • 0 Votes
    7 Posts
    3k Views

    @PitaJ thanks for your suggest. I resolve with this ( 🙂 )
    https://github.com/umdjs/umd/blob/master/templates/commonjsStrict.js

  • 0 Votes
    2 Posts
    2k Views

    Found the solution, importing too much topics in a single category hangs the nodebb, import some data than move it to some temporary category. Thasn import remaining data, meanwhile delete mongodb import Garbaze in using these mongo commands

    db.objects.update({},{$unset: {_imported_tid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_uid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_cid:1}},{multi: true}); db.objects.update({},{$unset: {_imported_slug:1}},{multi: true}); db.objects.update({},{$unset: {_imported_locked:1}},{multi: true}); db.objects.update({},{$unset: {_imported_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_title:1}},{multi: true}); db.objects.update({},{$unset: {_imported_content:1}},{multi: true}); db.objects.update({},{$unset: {_imported_guest:1}},{multi: true}); db.objects.update({},{$unset: {_imported_ip:1}},{multi: true}); db.objects.update({},{$unset: {_imported_user_slug:1}},{multi: true}); db.objects.update({},{$unset: {_imported_user_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_category_path:1}},{multi: true}); db.objects.update({},{$unset: {_imported_category_slug:1}},{multi: true});

    But keep in mind this will also delete the history of import will result in duplicate categories get imported or the posts, to prevent this keep writing post ids and category ids which you imported and delete them from the old database.

  • 0 Votes
    6 Posts
    3k Views

    Yeah, so then you're probably on v.1.1.2 or close to it. You need to wipe your DB, and then start over, checking out v1.0.0: cd <your NodeBB directory> && rm -rf node_modules && git checkout v1.0.0 && ./nodebb install

  • 0 Votes
    4 Posts
    3k Views

    For reference, @mondododo has opened an issue here:

    akhoury/nodebb-plugin-import#117

  • 0 Votes
    5 Posts
    2k Views

    As mega said you need to add all users to a sorted set called users:reputation.

    So go through all your users and add their user ids to users:reputation with the score being their reputation.

  • 0 Votes
    9 Posts
    5k Views

    Oh yes, back when I worked with php, adminer was a miracle. So much more lightweight compared to pma.

  • 0 Votes
    1 Posts
    1k Views

    Hi,

    I've been working on migrating an existing forum to nodebb and have the last steps left.
    I did a working test import and everything looks good.
    We are running NodeBB 0.6.1 on Mongo

    Now I would like to empty the database from users and discussions, while keeping all the settings I've made. The ACP is not an option, as there are quite a lot of users and discussions.

    Is there a simple way to do this?

  • 1 Votes
    4 Posts
    5k Views

    @bentael After some pause, I think I'm ready to work on custom importer. After some investigation I have found, that Importer works with classic/basic entities. Even If I will create custom importer, for example nodebb-plugin-import-ipboard-very-custom, import plugin will use only designed methods (I will be able to import additional fields) like: setup, getPaginatedUsers, getPaginatedCategories, getPaginatedTopics, getPaginatedPosts, and several utility methods like logging, testRun, etc.

    My question: as author of importer, what do you recommend to do if I want to import additional entities? (Example: awards)

    What I want to accomplish after import: Import of standard data: topics, categories, posts, users - It's simple and clear Import custom user fields without altering User document for future plugin use Import additional entity - Awards for future plugin use Import additional entity - Points(like reputation, but isn't part of user table) for future plugin use
  • 1 Votes
    6 Posts
    4k Views

    @arasbm For a 100 posts you can simply use the google groups' rss feed. Here's a post on stackexchange that explains how.

    Unfortunately I could not find a way to page the feed so if you have more than a 100 posts this probably wont work.

  • 0 Votes
    3 Posts
    2k Views

    Thank you @a_5mith, that's what I imagined but I think it's worth asking before putting some energy in that :).
    I'll follow your advice and take a look at other import plugins.
    Regards.

  • 1 Votes
    63 Posts
    29k Views

    Any chance in the mean time?

  • 0 Votes
    8 Posts
    4k Views

    @baris thanks!

    I don't like to brag 😛 but I kinda figured this out 16h ago

    I was checking uid==0 and skipping that out from deletion, but kept getting deleted. My admin uid kept incrementing for every node app --setup, so I looked at the schema again.

    but thanks your helper methods were extremely helpful.