Theme and stylesheet loading issues

Bug Reports
  • git reset --hard HEAD

    only v0.3.x works with categories - however the stylesheet.css is not loaded or found

  • @datz it is definitely the categories. any way i can refactor the categories to work from v0.3.x to the new master?

  • in our key store we have

    key values in the following formats:

    "categories:21:tid"

    "categories:recent_posts:cid:2"

    "categories:cid"

    "category:3"

    we see the following function return null/undefined:

    Categories.getAllCategories = function(uid, callback) {
                    db.getSortedSetRange('categories:cid', 0, -1, function(err, cids) {
                            if(err) {
                                    return callback(err);
                            }
    
                            if(cids && cids.length === 0) {
                                    return callback(null, {categories : []});
                            }
    
                        Categories.getCategories(cids, uid, callback);
                });
        };
    
  • ##Dumping categories:cid

    redis 127.0.0.1:6379[5]> dump categories:cid
    "\n>>\x00\x00\x00:\x00\x00\x00\x15\x00\x00\xf2\x02\xf3\x02\xf4\x02\xf5\x02\xf6\x02\xf7\x02\xf8\x02\xf9\x02\xfa\x02\xfb\x02\xfc\x02\xfd\x02\xfe\r\x03\xfe\x0e\x03\xfe\x0f\x03\xfe\x10\x03\xfe\x11\x03\xfe\x12\x03\xfe\x13\x03\xfe\x14\x03\xfe\x15\xff\x06\x00\xc5V7c\x9a\x06\x1d\xec"
    
  • What does zrange categories:cid 0 -1 say?

  • zrange categories:cid 0 -1

    @baris

    redis 127.0.0.1:6379[5]> zrange categories:cid 0 -1
    (error) ERR Operation against a key holding the wrong kind of value
    
  • any way to salvage this? lots of important data on here.

  • Looks like you didn't run the upgrade that updated categories to a sorted set then. Try updating to latest and then ./nodebb upgrade. Don't forget to make a backup of your database.

  • @baris yes i have the latest code and did a upgrade

  • silent error and death on upgrade

    info: NodeBB v0.3.2 Copyright (C) 2013 DesignCreatePlay Inc.
    info: This program comes with ABSOLUTELY NO WARRANTY.
    info: This is free software, and you are welcome to redistribute it under certain conditions.
    info:
    info: Time: Thu Feb 27 2014 06:16:11 GMT+0000 (UTC)
    info: Initializing NodeBB v0.3.2
    info: * using configuration stored in: /home/ubuntu/community/config.json
    info: * using redis store at 127.0.0.1:6379
    info: * using themes stored in: /home/ubuntu/community/node_modules
    warn: You have no redis password setup!
    info: Enabling 'trust proxy'
    warn: Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:
    warn: node app --upgrade
    warn: To ignore this error (not recommended):
    warn: node app --no-check-schema

  • excuse me

    on upgrade

    info: [2014/2/20] Activating NodeBB Essential Widgets
    warn: [plugins/nodebb-plugin-youtube] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-youtube] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-blog-comments] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-widget-essentials] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-widget-essentials] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-chat-emote] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-chat-emote] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-sso-github] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-imgur] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-sso-google] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-rss] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-sso-twitter] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-emoji-skype] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-emoji-skype] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-cash] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-cash] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-vimeo] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-vimeo] staticDir is deprecated, define CSS files with new staticDirs instead.
    info: Enabling 'trust proxy'
    error: [app] Encountered Uncaught Exception: path must be a string
    TypeError: path must be a string
    at Object.fs.readdir (fs.js:649:11)
    at Object.Meta.themes.get (/home/ubuntu/community/src/meta.js:89:7)
    at /home/ubuntu/community/src/webserver.js:350:19
    at /home/ubuntu/community/node_modules/async/lib/async.js:505:21
    at /home/ubuntu/community/node_modules/async/lib/async.js:221:13
    at /home/ubuntu/community/node_modules/async/lib/async.js:105:13
    at Array.forEach (native)
    at _each (/home/ubuntu/community/node_modules/async/lib/async.js:32:24)
    at async.each (/home/ubuntu/community/node_modules/async/lib/async.js:104:9)
    at _asyncMap (/home/ubuntu/community/node_modules/async/lib/async.js:220:9)
    error: [app] Could not restart server. Shutting down.
    info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Database connection closed.
    info: [app] Goodbye!

  • error: [app] Encountered Uncaught Exception: path must be a string

  • ###themePath not a string? or file names not string? possible hidden files .file?
    fs.readdir(themePath, function (err, files) {
    async.filter(files, function (file, next) {
    fs.stat(path.join(themePath, file), function (err, fileStat) {
    if (err) {
    return next(false);
    }

                                                next((fileStat.isDirectory() && file.slice(0, 13) === 'nodebb-theme-'));
                                        });
                                }, function (themes) {
                                        async.map(themes, function (theme, next) {
                                                var config = path.join(themePath, theme, 'theme.json');
    
                                                if (fs.existsSync(config)) {
                                                        fs.readFile(config, function (err, file) {
                                                                if (err) return next();
                                                                else {
                                                                        var configObj = JSON.parse(file.toString());
                                                                        next(err, configObj);
                                                                }
                                                        });
                                                } else {
                                                        next();
                                                }
                                        }, function (err, themes) {
                                                themes = themes.filter(function (theme) {
                                                        return (theme !== undefined);
                                                });
                                                callback(null, themes);
                                        });
                                });
                        });
    
  • https://github.com/designcreateplay/NodeBB/blob/master/src/meta.js#L88 can you add console.log(themePath); on that line and let me know the result?

  • console.log(themePath);

    @baris undefined

  • where is it defined? where does nconf trace to? can i redefine it? what is the proper path?

  • Can you test with https://github.com/designcreateplay/NodeBB/commit/fb1313ec90ff093dd28aed205f9b7882ee82bd06 looks like themes_path wasnt set in upgrade

  • @baris ok we are good to go.

  • @baris also, how can i set a user as an admin from the redis-cli command line?

  • It is better to do that from the admin control panel.

    But if you don't have access to the ACP.

    hget group:gid administrators
    "1" <- use this value
    sadd  gid:1:members <uid> 
    

    replace <uid> with your user id.

    To get the user id use :

    hget username:uid <yourusername>
    


Suggested Topics