diff options
Diffstat (limited to 'install')
-rw-r--r-- | install/INSTALL.txt | 55 | ||||
-rwxr-xr-x | install/htconfig.sample.php | 4 | ||||
-rw-r--r-- | install/sample-lighttpd.conf | 90 | ||||
-rw-r--r-- | install/sample-nginx.conf | 142 | ||||
-rw-r--r-- | install/schema_mysql.sql | 596 | ||||
-rw-r--r-- | install/schema_postgres.sql | 164 | ||||
-rw-r--r-- | install/update.php | 178 |
7 files changed, 782 insertions, 447 deletions
diff --git a/install/INSTALL.txt b/install/INSTALL.txt index 7c4209896..c81510522 100644 --- a/install/INSTALL.txt +++ b/install/INSTALL.txt @@ -1,23 +1,23 @@ -Red Matrix Installation +Hubzilla Installation -We've tried very hard to ensure that the Red Matrix will run on commodity +We've tried very hard to ensure that the Hubzilla will run on commodity hosting platforms - such as those used to host Wordpress blogs and Drupal websites. It will run on most any Linux VPS system. Windows LAMP platforms such as XAMPP and WAMP are not officially supported at this time - however we welcome patches if you manage to get it working. -Be aware that the Red Matrix is more than a simple web application. It is a +Be aware that the Hubzilla is more than a simple web application. It is a complex communications system which more closely resembles an email server than a web server. For reliability and performance, messages are delivered in the background and are queued for later delivery when sites are down. This kind of functionality requires a bit more of the host system than the typical blog. Not every PHP/MySQL hosting provider will be able to support the -Red Matrix. Many will - but please review the requirements and confirm these +Hubzilla. Many will - but please review the requirements and confirm these with your hosting provider prior to installation. (And preferably before entering into a long-term contract.) If you encounter installation issues, please let us know via the Github issue -tracker (https://github.com/redmatrix/redmatrix/issues). Please be as clear as you +tracker (https://github.com/redmatrix/hubzilla/issues). Please be as clear as you can about your operating environment and provide as much detail as possible about any error messages you may see, so that we can prevent it from happening in the future. Due to the large variety of operating systems and PHP platforms @@ -29,7 +29,7 @@ issues. Before you begin: Choose a domain name or subdomain name for your server. -The Red Matrix can only be installed into the root of a domain or +The Hubzilla can only be installed into the root of a domain or sub-domain, and can not be installed using alternate TCP ports. Decide if you will use SSL and obtain an SSL certificate before software @@ -57,7 +57,7 @@ Free "browser-valid" certificates are available from providers such as StartSSL. If you do NOT use SSL, there may be a delay of up to a minute for the initial install script - while we check the SSL port to see if anything responds there. -When communicating with new sites, Red Matrix always attempts connection on the +When communicating with new sites, Hubzilla always attempts connection on the SSL port first, before falling back to a less secure connection. If you do not use SSL, your webserver must not listen on port 443 at all. @@ -87,7 +87,7 @@ use SSL, your webserver must not listen on port 443 at all. - Installation into a top-level domain or sub-domain (without a directory/path component in the URL) is REQUIRED. -2. Unpack the RedMatrix files into the root of your web server document area. +2. Unpack the Hubzilla files into the root of your web server document area. If you copy the directory tree to your webserver, make sure that you also copy .htaccess - as "dot" files are often hidden and aren't normally @@ -98,7 +98,7 @@ use SSL, your webserver must not listen on port 443 at all. software much easier to update. The Linux command to clone the repository into a directory "mywebsite" would be - git clone https://github.com/redmatrix/redmatrix.git mywebsite + git clone https://github.com/redmatrix/hubzilla.git mywebsite - and then you can pick up the latest changes at any time with @@ -126,10 +126,10 @@ use SSL, your webserver must not listen on port 443 at all. cd mywebsite - Then you should clone the addon repository (separately). We'll give this repository - a nickname of 'matrix'. You can pull in other redmatrix addon repositories by + a nickname of 'matrix'. You can pull in other hubzilla addon repositories by giving them different nicknames. - util/add_addon_repo https://github.com/redmatrix/redmatrix-addons.git matrix + util/add_addon_repo https://github.com/redmatrix/hubzilla-addons.git matrix - For keeping the addon tree updated, you should be on your top level website directory and issue an update command for that repository. @@ -137,9 +137,22 @@ use SSL, your webserver must not listen on port 443 at all. cd mywebsite util/update_addon_repo matrix + - Create searchable represenations of the online documentation. You may do this any time + that the documentation is updated. + + cd mywebsite + util/importdoc + + + 3. Create an empty database and note the access details (hostname, username, -password, database name). +password, database name). The MySQL client libraries will fallback to socket +communication if the hostname is 'localhost' and some people have reported +issues with the socket implementation. Use it if your requirements mandate. +Otherwise if the database is served on the local server, use '127.0.0.1' for +the hostname. See https://dev.mysql.com/doc/refman/5.0/en/connecting.html +for more information. 4. If you know in advance that it will be impossible for the web server to write or create files in your web directory, create an empty file called @@ -186,7 +199,7 @@ one shown, substituting for your unique paths and settings: You can generally find the location of PHP by executing "which php". If you have troubles with this section please contact your hosting provider for -assistance. RedMatrix will not work correctly if you cannot perform this step. +assistance. Hubzilla will not work correctly if you cannot perform this step. You should also be sure that $a->config['system']['php_path'] is set correctly, it should look like (changing it to the correct PHP location) @@ -233,7 +246,7 @@ generally be world-readable. Ensure that mod-rewite is installed and working, and that your .htaccess file is being used. To verify the latter, create a file test.out -containing the word "test" in the top directory of the RedMatrix, make it world +containing the word "test" in the top directory of the Hubzilla, make it world readable and point your web browser to http://yoursitenamehere.com/test.out @@ -283,7 +296,7 @@ Retry the installation. As soon as the database has been created, ##################################################################### - Some configurations with "suhosin" security are configured without -an ability to run external processes. The Red Matrix requires this ability. +an ability to run external processes. The Hubzilla requires this ability. Following are some notes provided by one of our members. ##################################################################### @@ -293,26 +306,26 @@ certain functions like proc_open, as configured in /etc/php5/conf.d/suhosin.ini: suhosin.executor.func.blacklist = proc_open, ... -For those sites like Red Matrix that really need these functions they can be -enabled, e.g. in /etc/apache2/sites-available/redmatrix: +For those sites like Hubzilla that really need these functions they can be +enabled, e.g. in /etc/apache2/sites-available/hubzilla: - <Directory /var/www/redmatrix/> + <Directory /var/www/hubzilla/> php_admin_value suhosin.executor.func.blacklist none php_admin_value suhosin.executor.eval.blacklist none </Directory> -This enables every function for Red Matrix if accessed via browser, but not for +This enables every function for Hubzilla if accessed via browser, but not for the cronjob that is called via php command line. I attempted to enable it for cron by using something like - */10 * * * * cd /var/www/redmatrix/ && sudo -u www-data /usr/bin/php + */10 * * * * cd /var/www/hubzilla/ && sudo -u www-data /usr/bin/php -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none -f include/poller.php This worked well for simple test cases, but the cron job still failed with a fatal error: suhosin[22962]: ALERT - function within blacklist called: proc_open() (attacker -'REMOTE_ADDR not set', file '/var/www/redmatrix/boot.php', line 1341) +'REMOTE_ADDR not set', file '/var/www/hubzilla/boot.php', line 1341) After a while I noticed, that include/poller.php calls further php script via proc_open. These scripts themselves also use proc_open and fail, because they diff --git a/install/htconfig.sample.php b/install/htconfig.sample.php index 25ac2df7c..21697a951 100755 --- a/install/htconfig.sample.php +++ b/install/htconfig.sample.php @@ -3,7 +3,7 @@ // If automatic system installation fails: // Copy or rename this file to .htconfig.php in the top level -// Red Matrix directory +// Hubzilla directory // Why .htconfig.php? Because it contains sensitive information which could // give somebody complete control of your database. Apache's default @@ -40,7 +40,7 @@ $default_timezone = 'America/Los_Angeles'; // What is your site name? $a->config['system']['baseurl'] = 'https://myredsite.example'; -$a->config['system']['sitename'] = "Red Matrix"; +$a->config['system']['sitename'] = "Hubzilla"; $a->config['system']['location_hash'] = 'if the auto install failed, put a unique random string here'; diff --git a/install/sample-lighttpd.conf b/install/sample-lighttpd.conf new file mode 100644 index 000000000..db26c3b64 --- /dev/null +++ b/install/sample-lighttpd.conf @@ -0,0 +1,90 @@ +# See http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions + +### LOAD MODULES +server.modules = ( + "mod_access", + "mod_accesslog", + "mod_fastcgi", + "mod_redirect", + "mod_rewrite" +) + +### BASIC STUFF +server.port = 80 + +server.username = "http" + +server.groupname = "http" + +server.document-root = "/path/to/your/www/files" #adjust to your setup + +server.errorlog = "/var/log/lighttpd/error.log" + +accesslog.filename = "/var/log/lighttpd/access.log" + +### DISABLE DIR LISTING +dir-listing.activate = "disable" + +### DISABLE REJECT EXPECT HEADER +### (needed for curl POST requests - otherwise they fail with error 417) +server.reject-expect-100-with-417 = "disable" + +### DEFINE SUPPORTED INDEX FILENAMES +index-file.names = ( + "index.html", + "index.htm", + "index.php" +) + +### DEFINE SUPPORTED MIME TYPES +mimetype.assign = ( + ".html" => "text/html", + ".htm" => "text/html", + ".css" => "text/css", + ".txt" => "text/plain", + ".svg" => "image/svg+xml", + ".jpg" => "image/jpeg", + ".png" => "image/png" +) + +### DONT EVER SERVE FILES WITH EXTENSION +static-file.exclude-extensions = ( ".php" ) + +### PHP WITH PHP-FPM +### (needs php-fpm installed and running) +fastcgi.server = ( + ".php" => ( + "localhost" => ( + "socket" => "/run/php-fpm/php-fpm.sock", + "broken-scriptfilename" => "enable", + "allow-x-sendfile" => "enable" + ) + ) +) + +### ENABLE SSL +$SERVER["socket"] == ":443" { + ssl.engine = "enable" + ssl.ca-file = "/etc/lighttpd/certs/ca-certs.crt" #adjust to your needs + ssl.pemfile = "/etc/lighttpd/certs/red-ssl.crt" #adjust to your needs + + ssl.use-compression = "disable" + ssl.use-sslv2 = "disable" + ssl.use-sslv3 = "disable" + ssl.cipher-list = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA" +} + +### RISTRICT ACCESS TO DIRECTORYS AND FILES +$HTTP["url"] =~ "\.(out|log|htaccess)$" { + url.access-deny = ("") +} + +$HTTP["url"] =~ "(^|/)\.git|(^|/)store" { + url.access-deny = ("") +} + +### URL REWRITE RULES +url.rewrite-if-not-file = ( + "^\/([^\?]*)\?(.*)$" => "/index.php?q=$1&$2", + "^\/(.*)$" => "/index.php?q=$1" +) diff --git a/install/sample-nginx.conf b/install/sample-nginx.conf new file mode 100644 index 000000000..e9a80d226 --- /dev/null +++ b/install/sample-nginx.conf @@ -0,0 +1,142 @@ +## +# Red Nginx configuration +# by Olaf Conradi +# +# On Debian based distributions you can add this file to +# /etc/nginx/sites-available +# +# Then customize to your needs. To enable the configuration +# symlink it to /etc/nginx/sites-enabled and reload Nginx using +# +# service nginx reload +## + +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# +# http://wiki.nginx.org/Pitfalls +# http://wiki.nginx.org/QuickStart +# http://wiki.nginx.org/Configuration +## + +## +# This configuration assumes your domain is example.net +# You have a separate subdomain red.example.net +# You want all red traffic to be https +# You have an SSL certificate and key for your subdomain +# You have PHP FastCGI Process Manager (php5-fpm) running on localhost +# You have Red installed in /var/www/red +## + +server { + listen 80; + server_name red.example.net; + + index index.php; + root /var/www/red; + rewrite ^ https://red.example.net$request_uri? permanent; +} + +## +# Configure Red with SSL +# +# All requests are routed to the front controller +# except for certain known file types like images, css, etc. +# Those are served statically whenever possible with a +# fall back to the front controller (needed for avatars, for example) +## + +server { + listen 443 ssl; + server_name red.example.net; + + ssl on; + ssl_certificate /etc/nginx/ssl/red.example.net.chain.pem; + ssl_certificate_key /etc/nginx/ssl/example.net.key; + ssl_session_timeout 5m; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA:!DHE-RSA-AES256-SHA256:!DHE-RSA-CAMELLIA128-SHA:!DHE-RSA-CAMELLIA256-SHA; + ssl_prefer_server_ciphers on; + + fastcgi_param HTTPS on; + + index index.php; + charset utf-8; + root /var/www/red; + access_log /var/log/nginx/red.log; + #Uncomment the following line to include a standard configuration file + #Note that the most specific rule wins and your standard configuration + #will therefore *add* to this file, but not override it. + #include standard.conf + # allow uploads up to 20MB in size + client_max_body_size 20m; + client_body_buffer_size 128k; + + # rewrite to front controller as default rule + location / { + if ($is_args != "") { + rewrite ^/(.*) /index.php?q=$uri&$args last; + } + rewrite ^/(.*) /index.php?q=$uri last; + } + + # make sure webfinger and other well known services aren't blocked + # by denying dot files and rewrite request to the front controller + location ^~ /.well-known/ { + allow all; + rewrite ^/(.*) /index.php?q=$uri&$args last; + } + + # statically serve these file types when possible + # otherwise fall back to front controller + # allow browser to cache them + # added .htm for advanced source code editor library + location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ { + expires 30d; + try_files $uri /index.php?q=$uri&$args; + } + + # block these file types + location ~* \.(tpl|md|tgz|log|out)$ { + deny all; + } + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # or a unix socket + location ~* \.php$ { + # Zero-day exploit defense. + # http://forum.nginx.org/read.php?2,88845,page=3 + # Won't work properly (404 error) if the file is not stored on this + # server, which is entirely possible with php-fpm/php-fcgi. + # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on + # another machine. And then cross your fingers that you won't get hacked. + try_files $uri =404; + + # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini + fastcgi_split_path_info ^(.+\.php)(/.+)$; + + # With php5-cgi alone: + # fastcgi_pass 127.0.0.1:9000; + + # With php5-fpm: + fastcgi_pass unix:/var/run/php5-fpm.sock; + + include fastcgi_params; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + # deny access to all dot files + location ~ /\. { + deny all; + } + +#deny access to store + + location ~ /store { + deny all; + } + + +} diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index ddc38486c..3dab6c822 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -1,8 +1,3 @@ --- -------------------------------------------------------- - --- --- Table structure for table `abook` --- CREATE TABLE IF NOT EXISTS `abook` ( `abook_id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -12,13 +7,19 @@ CREATE TABLE IF NOT EXISTS `abook` ( `abook_my_perms` int(11) NOT NULL DEFAULT '0', `abook_their_perms` int(11) NOT NULL DEFAULT '0', `abook_closeness` tinyint(3) unsigned NOT NULL DEFAULT '99', - `abook_rating` int(11) NOT NULL DEFAULT '0', - `abook_rating_text` TEXT NOT NULL DEFAULT '', `abook_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `abook_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `abook_connected` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `abook_dob` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `abook_flags` int(11) NOT NULL DEFAULT '0', + `abook_blocked` tinyint(4) NOT NULL DEFAULT '0', + `abook_ignored` tinyint(4) NOT NULL DEFAULT '0', + `abook_hidden` tinyint(4) NOT NULL DEFAULT '0', + `abook_archived` tinyint(4) NOT NULL DEFAULT '0', + `abook_pending` tinyint(4) NOT NULL DEFAULT '0', + `abook_unconnected` tinyint(4) NOT NULL DEFAULT '0', + `abook_self` tinyint(4) NOT NULL DEFAULT '0', + `abook_feed` tinyint(4) NOT NULL DEFAULT '0', `abook_profile` char(64) NOT NULL DEFAULT '', `abook_incl` TEXT NOT NULL DEFAULT '', `abook_excl` TEXT NOT NULL DEFAULT '', @@ -35,16 +36,16 @@ CREATE TABLE IF NOT EXISTS `abook` ( KEY `abook_profile` (`abook_profile`), KEY `abook_dob` (`abook_dob`), KEY `abook_connected` (`abook_connected`), - KEY `abook_rating` (`abook_rating`), - KEY `abook_channel_closeness` (`abook_channel`,`abook_closeness`) + KEY `abook_blocked` (`abook_blocked`), + KEY `abook_ignored` (`abook_ignored`), + KEY `abook_hidden` (`abook_hidden`), + KEY `abook_archived` (`abook_archived`), + KEY `abook_pending` (`abook_pending`), + KEY `abook_unconnected` (`abook_unconnected`), + KEY `abook_self` (`abook_self`), + KEY `abook_feed` (`abook_feed`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `account` --- - CREATE TABLE IF NOT EXISTS `account` ( `account_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_parent` int(10) unsigned NOT NULL DEFAULT '0', @@ -78,12 +79,6 @@ CREATE TABLE IF NOT EXISTS `account` ( KEY `account_password_changed` (`account_password_changed`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `addon` --- - CREATE TABLE IF NOT EXISTS `addon` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` char(255) NOT NULL DEFAULT '', @@ -96,13 +91,7 @@ CREATE TABLE IF NOT EXISTS `addon` ( KEY `hidden` (`hidden`), KEY `name` (`name`), KEY `installed` (`installed`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `app` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `app` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -119,6 +108,8 @@ CREATE TABLE IF NOT EXISTS `app` ( `app_price` char(255) NOT NULL DEFAULT '', `app_page` char(255) NOT NULL DEFAULT '', `app_requires` char(255) NOT NULL DEFAULT '', + `app_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `app_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `app_id` (`app_id`), KEY `app_name` (`app_name`), @@ -126,14 +117,10 @@ CREATE TABLE IF NOT EXISTS `app` ( KEY `app_photo` (`app_photo`), KEY `app_version` (`app_version`), KEY `app_channel` (`app_channel`), - KEY `app_price` (`app_price`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `attach` --- + KEY `app_price` (`app_price`), + KEY `app_created` (`app_created`), + KEY `app_edited` (`app_edited`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `attach` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -147,6 +134,11 @@ CREATE TABLE IF NOT EXISTS `attach` ( `revision` int(10) unsigned NOT NULL DEFAULT '0', `folder` char(64) NOT NULL DEFAULT '', `flags` int(10) unsigned NOT NULL DEFAULT '0', + `is_dir` tinyint(1) NOT NULL DEFAULT '0', + `is_photo` tinyint(1) NOT NULL DEFAULT '0', + `os_storage` tinyint(1) NOT NULL DEFAULT '0', + `os_path` mediumtext NOT NULL, + `display_path` mediumtext NOT NULL, `data` longblob NOT NULL, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -166,14 +158,11 @@ CREATE TABLE IF NOT EXISTS `attach` ( KEY `revision` (`revision`), KEY `folder` (`folder`), KEY `flags` (`flags`), - KEY `creator` (`creator`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `auth_codes` --- + KEY `creator` (`creator`), + KEY `is_dir` (`is_dir`), + KEY `is_photo` (`is_photo`), + KEY `os_storage` (`os_storage`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `auth_codes` ( `id` varchar(40) NOT NULL DEFAULT '', @@ -184,12 +173,6 @@ CREATE TABLE IF NOT EXISTS `auth_codes` ( PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `cache` --- - CREATE TABLE IF NOT EXISTS `cache` ( `k` char(255) NOT NULL DEFAULT '', `v` text NOT NULL, @@ -197,12 +180,6 @@ CREATE TABLE IF NOT EXISTS `cache` ( PRIMARY KEY (`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `channel` --- - CREATE TABLE IF NOT EXISTS `channel` ( `channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel_account_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -250,6 +227,8 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '0', `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '0', `channel_w_like` int(10) unsigned NOT NULL DEFAULT '0', + `channel_removed` tinyint(1) NOT NULL DEFAULT '0', + `channel_system` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`channel_id`), UNIQUE KEY `channel_address_unique` (`channel_address`), KEY `channel_account_id` (`channel_account_id`), @@ -285,16 +264,12 @@ CREATE TABLE IF NOT EXISTS `channel` ( KEY `channel_deleted` (`channel_deleted`), KEY `channel_a_republish` (`channel_a_republish`), KEY `channel_dirdate` (`channel_dirdate`), - KEY `channel_lastpost` (`channel_lastpost`), - KEY `channel_w_like` (`channel_w_like`) + KEY `channel_w_like` (`channel_w_like`), + KEY `channel_removed` (`channel_removed`), + KEY `channel_system` (`channel_system`), + KEY `channel_lastpost` (`channel_lastpost`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `chat` --- - CREATE TABLE IF NOT EXISTS `chat` ( `chat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `chat_room` int(10) unsigned NOT NULL DEFAULT '0', @@ -305,13 +280,7 @@ CREATE TABLE IF NOT EXISTS `chat` ( KEY `chat_room` (`chat_room`), KEY `chat_xchan` (`chat_xchan`), KEY `created` (`created`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `chatpresence` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `chatpresence` ( `cp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -327,12 +296,6 @@ CREATE TABLE IF NOT EXISTS `chatpresence` ( KEY `cp_status` (`cp_status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `chatroom` --- - CREATE TABLE IF NOT EXISTS `chatroom` ( `cr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cr_aid` int(10) unsigned NOT NULL DEFAULT '0', @@ -352,13 +315,7 @@ CREATE TABLE IF NOT EXISTS `chatroom` ( KEY `cr_created` (`cr_created`), KEY `cr_edited` (`cr_edited`), KEY `cr_expire` (`cr_expire`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `clients` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `clients` ( `client_id` varchar(20) NOT NULL DEFAULT '', @@ -370,12 +327,6 @@ CREATE TABLE IF NOT EXISTS `clients` ( PRIMARY KEY (`client_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `config` --- - CREATE TABLE IF NOT EXISTS `config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cat` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', @@ -385,12 +336,6 @@ CREATE TABLE IF NOT EXISTS `config` ( UNIQUE KEY `access` (`cat`,`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `conv` --- - CREATE TABLE IF NOT EXISTS `conv` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `guid` char(255) NOT NULL DEFAULT '', @@ -405,11 +350,24 @@ CREATE TABLE IF NOT EXISTS `conv` ( KEY `updated` (`updated`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `event` --- +CREATE TABLE IF NOT EXISTS `dreport` ( + `dreport_id` int(11) NOT NULL AUTO_INCREMENT, + `dreport_channel` int(11) NOT NULL DEFAULT '0', + `dreport_mid` char(255) NOT NULL DEFAULT '', + `dreport_site` char(255) NOT NULL DEFAULT '', + `dreport_recip` char(255) NOT NULL DEFAULT '', + `dreport_result` char(255) NOT NULL DEFAULT '', + `dreport_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `dreport_xchan` char(255) NOT NULL DEFAULT '', + `dreport_queue` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`dreport_id`), + KEY `dreport_mid` (`dreport_mid`), + KEY `dreport_site` (`dreport_site`), + KEY `dreport_time` (`dreport_time`), + KEY `dreport_xchan` (`dreport_xchan`), + KEY `dreport_queue` (`dreport_queue`), + KEY `dreport_channel` (`dreport_channel`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `event` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -438,6 +396,7 @@ CREATE TABLE IF NOT EXISTS `event` ( `event_repeat` text NOT NULL, `event_sequence` smallint(6) NOT NULL DEFAULT '0', `event_priority` smallint(6) NOT NULL DEFAULT '0', + `event_vdata` text NOT NULL, PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `type` (`type`), @@ -454,12 +413,6 @@ CREATE TABLE IF NOT EXISTS `event` ( KEY `event_priority` (`event_priority`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `fcontact` --- - CREATE TABLE IF NOT EXISTS `fcontact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `url` char(255) NOT NULL, @@ -482,12 +435,6 @@ CREATE TABLE IF NOT EXISTS `fcontact` ( KEY `network` (`network`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ffinder` --- - CREATE TABLE IF NOT EXISTS `ffinder` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL, @@ -499,12 +446,6 @@ CREATE TABLE IF NOT EXISTS `ffinder` ( KEY `fid` (`fid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `fserver` --- - CREATE TABLE IF NOT EXISTS `fserver` ( `id` int(11) NOT NULL AUTO_INCREMENT, `server` char(255) NOT NULL DEFAULT '', @@ -515,12 +456,6 @@ CREATE TABLE IF NOT EXISTS `fserver` ( KEY `posturl` (`posturl`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `fsuggest` --- - CREATE TABLE IF NOT EXISTS `fsuggest` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', @@ -534,12 +469,6 @@ CREATE TABLE IF NOT EXISTS `fsuggest` ( PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `groups` --- - CREATE TABLE IF NOT EXISTS `groups` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(255) NOT NULL DEFAULT '', @@ -554,12 +483,6 @@ CREATE TABLE IF NOT EXISTS `groups` ( KEY `hash` (`hash`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `group_member` --- - CREATE TABLE IF NOT EXISTS `group_member` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL DEFAULT '0', @@ -571,12 +494,6 @@ CREATE TABLE IF NOT EXISTS `group_member` ( KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `hook` --- - CREATE TABLE IF NOT EXISTS `hook` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hook` char(255) NOT NULL DEFAULT '', @@ -585,13 +502,7 @@ CREATE TABLE IF NOT EXISTS `hook` ( `priority` int(11) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `hook` (`hook`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `hubloc` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `hubloc` ( `hubloc_id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -610,6 +521,10 @@ CREATE TABLE IF NOT EXISTS `hubloc` ( `hubloc_sitekey` text NOT NULL, `hubloc_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `hubloc_connected` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `hubloc_primary` tinyint(1) NOT NULL DEFAULT '0', + `hubloc_orphancheck` tinyint(1) NOT NULL DEFAULT '0', + `hubloc_error` tinyint(1) NOT NULL DEFAULT '0', + `hubloc_deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`hubloc_id`), KEY `hubloc_url` (`hubloc_url`), KEY `hubloc_guid` (`hubloc_guid`), @@ -620,15 +535,13 @@ CREATE TABLE IF NOT EXISTS `hubloc` ( KEY `hubloc_updated` (`hubloc_updated`), KEY `hubloc_connected` (`hubloc_connected`), KEY `hubloc_status` (`hubloc_status`), - KEY `hubloc_network` (`hubloc_network`) + KEY `hubloc_network` (`hubloc_network`), + KEY `hubloc_primary` (`hubloc_primary`), + KEY `hubloc_orphancheck` (`hubloc_orphancheck`), + KEY `hubloc_deleted` (`hubloc_deleted`), + KEY `hubloc_error` (`hubloc_error`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `issue` --- - CREATE TABLE IF NOT EXISTS `issue` ( `issue_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `issue_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -646,12 +559,6 @@ CREATE TABLE IF NOT EXISTS `issue` ( KEY `issue_component` (`issue_component`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `item` --- - CREATE TABLE IF NOT EXISTS `item` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mid` char(255) CHARACTER SET ascii NOT NULL DEFAULT '', @@ -673,6 +580,7 @@ CREATE TABLE IF NOT EXISTS `item` ( `mimetype` char(255) NOT NULL DEFAULT '', `title` text NOT NULL, `body` mediumtext NOT NULL, + `html` mediumtext NOT NULL, `app` char(255) NOT NULL DEFAULT '', `lang` char(64) NOT NULL DEFAULT '', `revision` int(10) unsigned NOT NULL DEFAULT '0', @@ -701,8 +609,30 @@ CREATE TABLE IF NOT EXISTS `item` ( `deny_gid` mediumtext NOT NULL, `item_restrict` int(11) NOT NULL DEFAULT '0', `item_flags` int(11) NOT NULL DEFAULT '0', - `item_private` tinyint(4) NOT NULL DEFAULT '0', - `item_unseen` smallint(1) NOT NULL DEFAULT '0', + `item_private` tinyint(1) NOT NULL DEFAULT '0', + `item_origin` tinyint(1) NOT NULL DEFAULT '0', + `item_unseen` tinyint(1) NOT NULL DEFAULT '0', + `item_starred` tinyint(1) NOT NULL DEFAULT '0', + `item_uplink` tinyint(1) NOT NULL DEFAULT '0', + `item_consensus` tinyint(1) NOT NULL DEFAULT '0', + `item_wall` tinyint(1) NOT NULL DEFAULT '0', + `item_thread_top` tinyint(1) NOT NULL DEFAULT '0', + `item_notshown` tinyint(1) NOT NULL DEFAULT '0', + `item_nsfw` tinyint(1) NOT NULL DEFAULT '0', + `item_relay` tinyint(1) NOT NULL DEFAULT '0', + `item_mentionsme` tinyint(1) NOT NULL DEFAULT '0', + `item_nocomment` tinyint(1) NOT NULL DEFAULT '0', + `item_obscured` tinyint(1) NOT NULL DEFAULT '0', + `item_verified` tinyint(1) NOT NULL DEFAULT '0', + `item_retained` tinyint(1) NOT NULL DEFAULT '0', + `item_rss` tinyint(1) NOT NULL DEFAULT '0', + `item_deleted` tinyint(1) NOT NULL DEFAULT '0', + `item_type` int(11) NOT NULL DEFAULT '0', + `item_hidden` tinyint(1) NOT NULL DEFAULT '0', + `item_unpublished` tinyint(1) NOT NULL DEFAULT '0', + `item_delayed` tinyint(1) NOT NULL DEFAULT '0', + `item_pending_remove` tinyint(1) NOT NULL DEFAULT '0', + `item_blocked` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `uid` (`uid`), KEY `parent` (`parent`), @@ -732,7 +662,29 @@ CREATE TABLE IF NOT EXISTS `item` ( KEY `public_policy` (`public_policy`), KEY `comments_closed` (`comments_closed`), KEY `changed` (`changed`), + KEY `item_origin` (`item_origin`), KEY `item_unseen` (`item_unseen`), + KEY `item_starred` (`item_starred`), + KEY `item_uplink` (`item_uplink`), + KEY `item_wall` (`item_wall`), + KEY `item_thread_top` (`item_thread_top`), + KEY `item_notshown` (`item_notshown`), + KEY `item_nsfw` (`item_nsfw`), + KEY `item_relay` (`item_relay`), + KEY `item_mentionsme` (`item_mentionsme`), + KEY `item_nocomment` (`item_nocomment`), + KEY `item_obscured` (`item_obscured`), + KEY `item_verified` (`item_verified`), + KEY `item_retained` (`item_retained`), + KEY `item_rss` (`item_rss`), + KEY `item_deleted` (`item_deleted`), + KEY `item_type` (`item_type`), + KEY `item_hidden` (`item_hidden`), + KEY `item_consensus` (`item_consensus`), + KEY `item_unpublished` (`item_unpublished`), + KEY `item_delayed` (`item_delayed`), + KEY `item_pending_remove` (`item_pending_remove`), + KEY `item_blocked` (`item_blocked`), FULLTEXT KEY `title` (`title`), FULLTEXT KEY `body` (`body`), FULLTEXT KEY `allow_cid` (`allow_cid`), @@ -741,12 +693,6 @@ CREATE TABLE IF NOT EXISTS `item` ( FULLTEXT KEY `deny_gid` (`deny_gid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `item_id` --- - CREATE TABLE IF NOT EXISTS `item_id` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `iid` int(11) NOT NULL DEFAULT '0', @@ -760,12 +706,6 @@ CREATE TABLE IF NOT EXISTS `item_id` ( KEY `iid` (`iid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `likes` --- - CREATE TABLE IF NOT EXISTS `likes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -786,17 +726,12 @@ CREATE TABLE IF NOT EXISTS `likes` ( KEY `target_type` (`target_type`), KEY `channel_id` (`channel_id`), KEY `target_id` (`target_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `mail` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `mail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `convid` int(10) unsigned NOT NULL DEFAULT '0', + `conv_guid` char(255) NOT NULL DEFAULT '', `mail_flags` int(10) unsigned NOT NULL DEFAULT '0', `from_xchan` char(255) NOT NULL DEFAULT '', `to_xchan` char(255) NOT NULL DEFAULT '', @@ -804,9 +739,16 @@ CREATE TABLE IF NOT EXISTS `mail` ( `channel_id` int(10) unsigned NOT NULL DEFAULT '0', `title` text NOT NULL, `body` mediumtext NOT NULL, + `sig` text NOT NULL, `attach` mediumtext NOT NULL, `mid` char(255) NOT NULL DEFAULT '', `parent_mid` char(255) NOT NULL DEFAULT '', + `mail_deleted` tinyint(4) NOT NULL DEFAULT '0', + `mail_replied` tinyint(4) NOT NULL DEFAULT '0', + `mail_isreply` tinyint(4) NOT NULL DEFAULT '0', + `mail_seen` tinyint(4) NOT NULL DEFAULT '0', + `mail_recalled` tinyint(4) NOT NULL DEFAULT '0', + `mail_obscured` smallint(6) NOT NULL DEFAULT '0', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), @@ -819,15 +761,16 @@ CREATE TABLE IF NOT EXISTS `mail` ( KEY `mid` (`mid`), KEY `parent_mid` (`parent_mid`), KEY `expires` (`expires`), - KEY `convid` (`convid`) + KEY `convid` (`convid`), + KEY `conv_guid` (`conv_guid`), + KEY `mail_deleted` (`mail_deleted`), + KEY `mail_replied` (`mail_replied`), + KEY `mail_isreply` (`mail_isreply`), + KEY `mail_seen` (`mail_seen`), + KEY `mail_recalled` (`mail_recalled`), + KEY `mail_obscured` (`mail_obscured`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `manage` --- - CREATE TABLE IF NOT EXISTS `manage` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', @@ -837,12 +780,6 @@ CREATE TABLE IF NOT EXISTS `manage` ( KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `menu` --- - CREATE TABLE IF NOT EXISTS `menu` ( `menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -859,12 +796,6 @@ CREATE TABLE IF NOT EXISTS `menu` ( KEY `menu_edited` (`menu_edited`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `menu_item` --- - CREATE TABLE IF NOT EXISTS `menu_item` ( `mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `mitem_link` char(255) NOT NULL DEFAULT '', @@ -881,13 +812,7 @@ CREATE TABLE IF NOT EXISTS `menu_item` ( KEY `mitem_channel_id` (`mitem_channel_id`), KEY `mitem_menu_id` (`mitem_menu_id`), KEY `mitem_flags` (`mitem_flags`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `notify` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `notify` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -917,12 +842,6 @@ CREATE TABLE IF NOT EXISTS `notify` ( KEY `aid` (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `obj` --- - CREATE TABLE IF NOT EXISTS `obj` ( `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `obj_page` char(64) NOT NULL DEFAULT '', @@ -930,6 +849,11 @@ CREATE TABLE IF NOT EXISTS `obj` ( `obj_type` int(10) unsigned NOT NULL DEFAULT '0', `obj_obj` char(255) NOT NULL DEFAULT '', `obj_channel` int(10) unsigned NOT NULL DEFAULT '0', + `obj_term` char(255) NOT NULL DEFAULT '', + `obj_url` char(255) NOT NULL DEFAULT '', + `obj_imgurl` char(255) NOT NULL DEFAULT '', + `obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, `deny_cid` mediumtext NOT NULL, @@ -939,14 +863,13 @@ CREATE TABLE IF NOT EXISTS `obj` ( KEY `obj_page` (`obj_page`), KEY `obj_type` (`obj_type`), KEY `obj_channel` (`obj_channel`), + KEY `obj_term` (`obj_term`), + KEY `obj_url` (`obj_url`), + KEY `obj_imgurl` (`obj_imgurl`), + KEY `obj_created` (`obj_created`), + KEY `obj_edited` (`obj_edited`), KEY `obj_obj` (`obj_obj`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `outq` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `outq` ( `outq_hash` char(255) NOT NULL, @@ -960,7 +883,7 @@ CREATE TABLE IF NOT EXISTS `outq` ( `outq_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `outq_notify` mediumtext NOT NULL, `outq_msg` mediumtext NOT NULL, - `outq_priority` smallint NOT NULL DEFAULT '0', + `outq_priority` smallint(6) NOT NULL DEFAULT '0', PRIMARY KEY (`outq_hash`), KEY `outq_account` (`outq_account`), KEY `outq_channel` (`outq_channel`), @@ -972,12 +895,6 @@ CREATE TABLE IF NOT EXISTS `outq` ( KEY `outq_priority` (`outq_priority`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `pconfig` --- - CREATE TABLE IF NOT EXISTS `pconfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', @@ -988,12 +905,6 @@ CREATE TABLE IF NOT EXISTS `pconfig` ( UNIQUE KEY `access` (`uid`,`cat`,`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `photo` --- - CREATE TABLE IF NOT EXISTS `photo` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `aid` int(10) unsigned NOT NULL DEFAULT '0', @@ -1012,7 +923,12 @@ CREATE TABLE IF NOT EXISTS `photo` ( `size` int(10) unsigned NOT NULL DEFAULT '0', `data` mediumblob NOT NULL, `scale` tinyint(3) NOT NULL DEFAULT '0', + `photo_usage` smallint(6) NOT NULL DEFAULT '0', `profile` tinyint(1) NOT NULL DEFAULT '0', + `is_nsfw` tinyint(1) NOT NULL DEFAULT '0', + `os_storage` tinyint(1) NOT NULL DEFAULT '0', + `os_path` mediumtext NOT NULL, + `display_path` mediumtext NOT NULL, `photo_flags` int(10) unsigned NOT NULL DEFAULT '0', `allow_cid` mediumtext NOT NULL, `allow_gid` mediumtext NOT NULL, @@ -1028,15 +944,12 @@ CREATE TABLE IF NOT EXISTS `photo` ( KEY `aid` (`aid`), KEY `xchan` (`xchan`), KEY `size` (`size`), - KEY `resource_id` (`resource_id`) + KEY `resource_id` (`resource_id`), + KEY `is_nsfw` (`is_nsfw`), + KEY `os_storage` (`os_storage`), + KEY `photo_usage` (`photo_usage`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `poll` --- - CREATE TABLE IF NOT EXISTS `poll` ( `poll_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `poll_channel` int(10) unsigned NOT NULL DEFAULT '0', @@ -1049,12 +962,6 @@ CREATE TABLE IF NOT EXISTS `poll` ( KEY `poll_votes` (`poll_votes`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `poll_elm` --- - CREATE TABLE IF NOT EXISTS `poll_elm` ( `pelm_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pelm_poll` int(10) unsigned NOT NULL DEFAULT '0', @@ -1066,12 +973,6 @@ CREATE TABLE IF NOT EXISTS `poll_elm` ( KEY `pelm_result` (`pelm_result`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `profdef` --- - CREATE TABLE IF NOT EXISTS `profdef` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `field_name` char(255) NOT NULL DEFAULT '', @@ -1081,13 +982,7 @@ CREATE TABLE IF NOT EXISTS `profdef` ( `field_inputs` mediumtext NOT NULL, PRIMARY KEY (`id`), KEY `field_name` (`field_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `profext` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `profext` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -1099,13 +994,7 @@ CREATE TABLE IF NOT EXISTS `profext` ( KEY `channel_id` (`channel_id`), KEY `hash` (`hash`), KEY `k` (`k`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `profile` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -1169,12 +1058,6 @@ CREATE TABLE IF NOT EXISTS `profile` ( KEY `profile_guid` (`profile_guid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `profile_check` --- - CREATE TABLE IF NOT EXISTS `profile_check` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL DEFAULT '0', @@ -1190,12 +1073,6 @@ CREATE TABLE IF NOT EXISTS `profile_check` ( KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `register` --- - CREATE TABLE IF NOT EXISTS `register` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hash` char(255) NOT NULL DEFAULT '', @@ -1209,12 +1086,6 @@ CREATE TABLE IF NOT EXISTS `register` ( KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `session` --- - CREATE TABLE IF NOT EXISTS `session` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `sid` char(255) NOT NULL DEFAULT '', @@ -1225,12 +1096,6 @@ CREATE TABLE IF NOT EXISTS `session` ( KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `shares` --- - CREATE TABLE IF NOT EXISTS `shares` ( `share_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `share_type` int(11) NOT NULL DEFAULT '0', @@ -1242,12 +1107,6 @@ CREATE TABLE IF NOT EXISTS `shares` ( KEY `share_xchan` (`share_xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `sign` --- - CREATE TABLE IF NOT EXISTS `sign` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `iid` int(10) unsigned NOT NULL DEFAULT '0', @@ -1258,13 +1117,7 @@ CREATE TABLE IF NOT EXISTS `sign` ( PRIMARY KEY (`id`), KEY `iid` (`iid`), KEY `retract_iid` (`retract_iid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `site` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `site` ( `site_url` char(255) NOT NULL, @@ -1280,6 +1133,7 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_realm` char(255) NOT NULL DEFAULT '', `site_valid` smallint NOT NULL DEFAULT '0', `site_dead` smallint NOT NULL DEFAULT '0', + `site_type` smallint NOT NULL DEFAULT '0', `site_project` char(255) NOT NULL DEFAULT '', PRIMARY KEY (`site_url`), KEY `site_flags` (`site_flags`), @@ -1292,15 +1146,10 @@ CREATE TABLE IF NOT EXISTS `site` ( KEY `site_realm` (`site_realm`), KEY `site_valid` (`site_valid`), KEY `site_dead` (`site_dead`), + KEY `site_type` (`site_type`), KEY `site_project` (`site_project`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `source` --- - CREATE TABLE IF NOT EXISTS `source` ( `src_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `src_channel_id` int(10) unsigned NOT NULL DEFAULT '0', @@ -1311,13 +1160,7 @@ CREATE TABLE IF NOT EXISTS `source` ( KEY `src_channel_id` (`src_channel_id`), KEY `src_channel_xchan` (`src_channel_xchan`), KEY `src_xchan` (`src_xchan`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `spam` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `spam` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -1333,12 +1176,6 @@ CREATE TABLE IF NOT EXISTS `spam` ( KEY `term` (`term`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `sys_perms` --- - CREATE TABLE IF NOT EXISTS `sys_perms` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cat` char(255) NOT NULL DEFAULT '', @@ -1348,12 +1185,6 @@ CREATE TABLE IF NOT EXISTS `sys_perms` ( PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `term` --- - CREATE TABLE IF NOT EXISTS `term` ( `tid` int(10) unsigned NOT NULL AUTO_INCREMENT, `aid` int(10) unsigned NOT NULL DEFAULT '0', @@ -1378,12 +1209,6 @@ CREATE TABLE IF NOT EXISTS `term` ( KEY `parent_hash` (`parent_hash`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `tokens` --- - CREATE TABLE IF NOT EXISTS `tokens` ( `id` varchar(40) NOT NULL DEFAULT '', `secret` text NOT NULL, @@ -1397,12 +1222,6 @@ CREATE TABLE IF NOT EXISTS `tokens` ( KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `updates` --- - CREATE TABLE IF NOT EXISTS `updates` ( `ud_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ud_hash` char(128) NOT NULL DEFAULT '', @@ -1420,12 +1239,6 @@ CREATE TABLE IF NOT EXISTS `updates` ( KEY `ud_last` (`ud_last`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `verify` --- - CREATE TABLE IF NOT EXISTS `verify` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel` int(10) unsigned NOT NULL DEFAULT '0', @@ -1441,12 +1254,6 @@ CREATE TABLE IF NOT EXISTS `verify` ( KEY `created` (`created`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `vote` --- - CREATE TABLE IF NOT EXISTS `vote` ( `vote_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `vote_poll` int(11) NOT NULL DEFAULT '0', @@ -1459,12 +1266,6 @@ CREATE TABLE IF NOT EXISTS `vote` ( KEY `vote_element` (`vote_element`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xchan` --- - CREATE TABLE IF NOT EXISTS `xchan` ( `xchan_hash` char(255) NOT NULL, `xchan_guid` char(255) NOT NULL DEFAULT '', @@ -1485,6 +1286,13 @@ CREATE TABLE IF NOT EXISTS `xchan` ( `xchan_flags` int(10) unsigned NOT NULL DEFAULT '0', `xchan_photo_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `xchan_name_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `xchan_hidden` tinyint(1) NOT NULL DEFAULT '0', + `xchan_orphan` tinyint(1) NOT NULL DEFAULT '0', + `xchan_censored` tinyint(1) NOT NULL DEFAULT '0', + `xchan_selfcensored` tinyint(1) NOT NULL DEFAULT '0', + `xchan_system` tinyint(1) NOT NULL DEFAULT '0', + `xchan_pubforum` tinyint(1) NOT NULL DEFAULT '0', + `xchan_deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`xchan_hash`), KEY `xchan_guid` (`xchan_guid`), KEY `xchan_addr` (`xchan_addr`), @@ -1494,15 +1302,16 @@ CREATE TABLE IF NOT EXISTS `xchan` ( KEY `xchan_flags` (`xchan_flags`), KEY `xchan_connurl` (`xchan_connurl`), KEY `xchan_instance_url` (`xchan_instance_url`), - KEY `xchan_follow` (`xchan_follow`) + KEY `xchan_follow` (`xchan_follow`), + KEY `xchan_hidden` (`xchan_hidden`), + KEY `xchan_orphan` (`xchan_orphan`), + KEY `xchan_censored` (`xchan_censored`), + KEY `xchan_selfcensored` (`xchan_selfcensored`), + KEY `xchan_system` (`xchan_system`), + KEY `xchan_pubforum` (`xchan_pubforum`), + KEY `xchan_deleted` (`xchan_deleted`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xchat` --- - CREATE TABLE IF NOT EXISTS `xchat` ( `xchat_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xchat_url` char(255) NOT NULL DEFAULT '', @@ -1516,12 +1325,6 @@ CREATE TABLE IF NOT EXISTS `xchat` ( KEY `xchat_edited` (`xchat_edited`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xconfig` --- - CREATE TABLE IF NOT EXISTS `xconfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xchan` char(255) NOT NULL DEFAULT '', @@ -1534,12 +1337,6 @@ CREATE TABLE IF NOT EXISTS `xconfig` ( KEY `k` (`k`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xign` --- - CREATE TABLE IF NOT EXISTS `xign` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL DEFAULT '0', @@ -1549,21 +1346,15 @@ CREATE TABLE IF NOT EXISTS `xign` ( KEY `xchan` (`xchan`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xlink` --- - CREATE TABLE IF NOT EXISTS `xlink` ( `xlink_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xlink_xchan` char(255) NOT NULL DEFAULT '', `xlink_link` char(255) NOT NULL DEFAULT '', `xlink_rating` int(11) NOT NULL DEFAULT '0', - `xlink_rating_text` TEXT NOT NULL DEFAULT '', + `xlink_rating_text` text NOT NULL, `xlink_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `xlink_static` tinyint(1) NOT NULL DEFAULT '0', - `xlink_sig` text NOT NULL DEFAULT '', + `xlink_sig` text NOT NULL, PRIMARY KEY (`xlink_id`), KEY `xlink_xchan` (`xlink_xchan`), KEY `xlink_link` (`xlink_link`), @@ -1572,27 +1363,16 @@ CREATE TABLE IF NOT EXISTS `xlink` ( KEY `xlink_static` (`xlink_static`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xperm` --- - CREATE TABLE IF NOT EXISTS `xperm` ( - `xp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , - `xp_client` VARCHAR( 20 ) NOT NULL DEFAULT '', - `xp_channel` INT UNSIGNED NOT NULL DEFAULT '0', - `xp_perm` VARCHAR( 64 ) NOT NULL DEFAULT '', + `xp_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `xp_client` varchar(20) NOT NULL DEFAULT '', + `xp_channel` int(10) unsigned NOT NULL DEFAULT '0', + `xp_perm` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`xp_id`), KEY `xp_client` (`xp_client`), KEY `xp_channel` (`xp_channel`), KEY `xp_perm` (`xp_perm`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `xprof` --- +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `xprof` ( `xprof_hash` char(255) NOT NULL, @@ -1624,12 +1404,6 @@ CREATE TABLE IF NOT EXISTS `xprof` ( KEY `xprof_hometown` (`xprof_hometown`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `xtag` --- - CREATE TABLE IF NOT EXISTS `xtag` ( `xtag_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `xtag_hash` char(255) NOT NULL DEFAULT '', diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 1f9ce753f..70a7a576a 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -6,13 +6,19 @@ CREATE TABLE "abook" ( "abook_my_perms" bigint NOT NULL DEFAULT '0', "abook_their_perms" bigint NOT NULL DEFAULT '0', "abook_closeness" numeric(3) NOT NULL DEFAULT '99', - "abook_rating" bigint NOT NULL DEFAULT '0', - "abook_rating_text" TEXT NOT NULL DEFAULT '', "abook_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "abook_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "abook_connected" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "abook_dob" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "abook_flags" bigint NOT NULL DEFAULT '0', + "abook_blocked" smallint NOT NULL DEFAULT '0', + "abook_ignored" smallint NOT NULL DEFAULT '0', + "abook_hidden" smallint NOT NULL DEFAULT '0', + "abook_archived" smallint NOT NULL DEFAULT '0', + "abook_pending" smallint NOT NULL DEFAULT '0', + "abook_unconnected" smallint NOT NULL DEFAULT '0', + "abook_self" smallint NOT NULL DEFAULT '0', + "abook_feed" smallint NOT NULL DEFAULT '0', "abook_profile" char(64) NOT NULL DEFAULT '', "abook_incl" TEXT NOT NULL DEFAULT '', "abook_excl" TEXT NOT NULL DEFAULT '', @@ -27,6 +33,14 @@ CREATE TABLE "abook" ( create index "abook_created" on abook ("abook_created"); create index "abook_updated" on abook ("abook_updated"); create index "abook_flags" on abook ("abook_flags"); + create index "abook_blocked" on abook ("abook_blocked"); + create index "abook_ignored" on abook ("abook_ignored"); + create index "abook_hidden" on abook ("abook_hidden"); + create index "abook_archived" on abook ("abook_archived"); + create index "abook_pending" on abook ("abook_pending"); + create index "abook_unconnected" on abook ("abook_unconnected"); + create index "abook_self" on abook ("abook_self"); + create index "abook_feed" on abook ("abook_feed"); create index "abook_profile" on abook ("abook_profile"); create index "abook_dob" on abook ("abook_dob"); create index "abook_connected" on abook ("abook_connected"); @@ -93,6 +107,8 @@ CREATE TABLE "app" ( "app_price" text NOT NULL DEFAULT '', "app_page" text NOT NULL DEFAULT '', "app_requires" text NOT NULL DEFAULT '', + "app_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "app_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ("id") ); create index "app_id" on app ("app_id"); @@ -102,6 +118,8 @@ create index "app_photo" on app ("app_photo"); create index "app_version" on app ("app_version"); create index "app_channel" on app ("app_channel"); create index "app_price" on app ("app_price"); +create index "app_created" on app ("app_created"); +create index "app_edited" on app ("app_edited"); CREATE TABLE "attach" ( "id" serial NOT NULL, "aid" bigint NOT NULL DEFAULT '0', @@ -114,6 +132,11 @@ CREATE TABLE "attach" ( "revision" bigint NOT NULL DEFAULT '0', "folder" varchar(64) NOT NULL DEFAULT '', "flags" bigint NOT NULL DEFAULT '0', + "is_dir" smallint NOT NULL DEFAULT '0', + "is_photo" smallint NOT NULL DEFAULT '0', + "os_storage" smallint NOT NULL DEFAULT '0', + "os_path" text NOT NULL, + "display_path" text NOT NULL, "data" bytea NOT NULL, "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', @@ -135,6 +158,9 @@ create index "attach_edited_idx" on attach ("edited"); create index "attach_revision_idx" on attach ("revision"); create index "attach_folder_idx" on attach ("folder"); create index "attach_flags_idx" on attach ("flags"); +create index "attach_is_dir_idx" on attach ("is_dir"); +create index "attach_is_photo_idx" on attach ("is_photo"); +create index "attach_os_storage_idx" on attach ("os_storage"); create index "attach_creator_idx" on attach ("creator"); CREATE TABLE "auth_codes" ( "id" varchar(40) NOT NULL, @@ -197,6 +223,8 @@ CREATE TABLE "channel" ( "channel_w_pages" bigint NOT NULL DEFAULT '128', "channel_a_republish" bigint NOT NULL DEFAULT '128', "channel_w_like" bigint NOT NULL DEFAULT '128', + "channel_removed" smallint NOT NULL DEFAULT '0', + "channel_system" smallint NOT NULL DEFAULT '0', PRIMARY KEY ("channel_id"), UNIQUE ("channel_address") ); @@ -235,6 +263,8 @@ create index "channel_a_republish" on channel ("channel_a_republish"); create index "channel_w_like" on channel ("channel_w_like"); create index "channel_dirdate" on channel ("channel_dirdate"); create index "channel_lastpost" on channel ("channel_lastpost"); +create index "channel_removed" on channel ("channel_removed"); +create index "channel_system" on channel ("channel_system"); CREATE TABLE "chat" ( "chat_id" serial NOT NULL, "chat_room" bigint NOT NULL DEFAULT '0', @@ -311,6 +341,30 @@ CREATE TABLE "conv" ( create index "conv_created_idx" on conv ("created"); create index "conv_updated_idx" on conv ("updated"); +CREATE TABLE IF NOT EXISTS "dreport" ( + "dreport_id" int(11) NOT NULL, + "dreport_channel" int(11) NOT NULL DEFAULT '0', + "dreport_mid" char(255) NOT NULL DEFAULT '', + "dreport_site" char(255) NOT NULL DEFAULT '', + "dreport_recip" char(255) NOT NULL DEFAULT '', + "dreport_result" char(255) NOT NULL DEFAULT '', + "dreport_time" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "dreport_xchan" char(255) NOT NULL DEFAULT '', + "dreport_queue" char(255) NOT NULL DEFAULT '', + PRIMARY KEY ("dreport_id") +); + +create index "dreport_mid" on dreport ("dreport_mid"); +create index "dreport_site" on dreport ("dreport_site"); +create index "dreport_time" on dreport ("dreport_time"); +create index "dreport_xchan" on dreport ("dreport_xchan"); +create index "dreport_queue" on dreport ("dreport_queue"); +create index "dreport_channel" on dreport ("dreport_channel"); + + + + + CREATE TABLE "event" ( "id" serial NOT NULL, "aid" bigint NOT NULL DEFAULT '0', @@ -338,6 +392,7 @@ CREATE TABLE "event" ( "event_repeat" text NOT NULL, "event_sequence" smallint NOT NULL DEFAULT '0', "event_priority" smallint NOT NULL DEFAULT '0', + "event_vdata" text NOT NULL, PRIMARY KEY ("id") ); create index "event_uid_idx" on event ("uid"); @@ -463,6 +518,10 @@ CREATE TABLE "hubloc" ( "hubloc_sitekey" text NOT NULL DEFAULT '', "hubloc_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "hubloc_connected" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "hubloc_primary" smallint NOT NULL DEFAULT '0', + "hubloc_orphancheck" smallint NOT NULL DEFAULT '0', + "hubloc_error" smallint NOT NULL DEFAULT '0', + "hubloc_deleted" smallint NOT NULL DEFAULT '0', PRIMARY KEY ("hubloc_id") ); create index "hubloc_url" on hubloc ("hubloc_url"); @@ -475,6 +534,10 @@ create index "hubloc_network" on hubloc ("hubloc_network"); create index "hubloc_updated" on hubloc ("hubloc_updated"); create index "hubloc_connected" on hubloc ("hubloc_connected"); create index "hubloc_status" on hubloc ("hubloc_status"); +create index "hubloc_primary" on hubloc ("hubloc_primary"); +create index "hubloc_orphancheck" on hubloc ("hubloc_orphancheck"); +create index "hubloc_error" on hubloc ("hubloc_error"); +create index "hubloc_deleted" on hubloc ("hubloc_deleted"); CREATE TABLE "issue" ( "issue_id" serial NOT NULL, "issue_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', @@ -513,6 +576,7 @@ CREATE TABLE "item" ( "mimetype" text NOT NULL DEFAULT '', "title" text NOT NULL, "body" text NOT NULL, + "html" text NOT NULL, "app" text NOT NULL DEFAULT '', "lang" varchar(64) NOT NULL DEFAULT '', "revision" bigint NOT NULL DEFAULT '0', @@ -543,6 +607,28 @@ CREATE TABLE "item" ( "item_flags" bigint NOT NULL DEFAULT '0', "item_private" numeric(4) NOT NULL DEFAULT '0', "item_unseen" smallint NOT NULL DEFAULT '0', + "item_wall" smallint NOT NULL DEFAULT '0', + "item_origin" smallint NOT NULL DEFAULT '0', + "item_starred" smallint NOT NULL DEFAULT '0', + "item_uplink" smallint NOT NULL DEFAULT '0', + "item_consensus" smallint NOT NULL DEFAULT '0', + "item_thread_top" smallint NOT NULL DEFAULT '0', + "item_notshown" smallint NOT NULL DEFAULT '0', + "item_nsfw" smallint NOT NULL DEFAULT '0', + "item_relay" smallint NOT NULL DEFAULT '0', + "item_mentionsme" smallint NOT NULL DEFAULT '0', + "item_nocomment" smallint NOT NULL DEFAULT '0', + "item_obscured" smallint NOT NULL DEFAULT '0', + "item_verified" smallint NOT NULL DEFAULT '0', + "item_retained" smallint NOT NULL DEFAULT '0', + "item_rss" smallint NOT NULL DEFAULT '0', + "item_deleted" smallint NOT NULL DEFAULT '0', + "item_type" int(11) NOT NULL DEFAULT '0', + "item_hidden" smallint NOT NULL DEFAULT '0', + "item_unpublished" smallint NOT NULL DEFAULT '0', + "item_delayed" smallint NOT NULL DEFAULT '0', + "item_pending_remove" smallint NOT NULL DEFAULT '0', + "item_blocked" smallint NOT NULL DEFAULT '0', "item_search_vector" tsvector, PRIMARY KEY ("id") ); @@ -575,7 +661,29 @@ create index "item_public_policy" on item ("public_policy"); create index "item_comment_policy" on item ("comment_policy"); create index "item_layout_mid" on item ("layout_mid"); create index "item_unseen" on item ("item_unseen"); +create index "item_wall" on item ("item_wall"); +create index "item_origin" on item ("item_origin"); +create index "item_starred" on item ("item_starred"); +create index "item_uplink" on item ("item_uplink"); +create index "item_consensus" on item ("item_consensus"); +create index "item_thread_top" on item ("item_thread_top"); +create index "item_notshown" on item ("item_notshown"); +create index "item_nsfw" on item ("item_nsfw"); +create index "item_relay" on item ("item_relay"); +create index "item_mentionsme" on item ("item_mentionsme"); +create index "item_nocomment" on item ("item_nocomment"); +create index "item_obscured" on item ("item_obscured"); +create index "item_verified" on item ("item_verified"); +create index "item_retained" on item ("item_retained"); +create index "item_rss" on item ("item_rss"); +create index "item_deleted" on item ("item_deleted"); +create index "item_type" on item ("item_type"); +create index "item_hidden" on item ("item_hidden"); +create index "item_unpublished" on item ("item_unpublished"); +create index "item_delayed" on item ("item_delayed"); +create index "item_pending_remove" on item ("item_pending_remove"); +create index "item_blocked" on item ("item_blocked"); -- fulltext indexes create index "item_search_idx" on item USING gist("item_search_vector"); create index "item_allow_cid" on item ("allow_cid"); @@ -620,21 +728,30 @@ create index "likes_target_id" on likes ("target_id"); CREATE TABLE "mail" ( "id" serial NOT NULL, "convid" bigint NOT NULL DEFAULT '0', + "conv_guid" text NOT NULL, "mail_flags" bigint NOT NULL DEFAULT '0', "from_xchan" text NOT NULL DEFAULT '', "to_xchan" text NOT NULL DEFAULT '', "account_id" bigint NOT NULL DEFAULT '0', - "channel_id" bigint NOT NULL, + "channel_id" bigint NOT NULL DEFAULT '0', "title" text NOT NULL, "body" text NOT NULL, + "sig" text NOT NULL, "attach" text NOT NULL DEFAULT '', "mid" text NOT NULL, "parent_mid" text NOT NULL, + "mail_deleted" smallint NOT NULL DEFAULT '0', + "mail_replied" smallint NOT NULL DEFAULT '0', + "mail_isreply" smallint NOT NULL DEFAULT '0', + "mail_seen" smallint NOT NULL DEFAULT '0', + "mail_recalled" smallint NOT NULL DEFAULT '0', + "mail_obscured" smallint NOT NULL DEFAULT '0', "created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', PRIMARY KEY ("id") ); create index "mail_convid" on mail ("convid"); +create index "mail_conv_guid" on mail ("conv_guid"); create index "mail_created" on mail ("created"); create index "mail_flags" on mail ("mail_flags"); create index "mail_account_id" on mail ("account_id"); @@ -644,6 +761,12 @@ create index "mail_to_xchan" on mail ("to_xchan"); create index "mail_mid" on mail ("mid"); create index "mail_parent_mid" on mail ("parent_mid"); create index "mail_expires" on mail ("expires"); +create index "mail_deleted" on mail ("mail_deleted"); +create index "mail_replied" on mail ("mail_replied"); +create index "mail_isreply" on mail ("mail_isreply"); +create index "mail_seen" on mail ("mail_seen"); +create index "mail_recalled" on mail ("mail_recalled"); +create index "mail_obscured" on mail ("mail_obscured"); CREATE TABLE "manage" ( "id" serial NOT NULL, "uid" bigint NOT NULL, @@ -720,6 +843,11 @@ CREATE TABLE "obj" ( "obj_type" bigint NOT NULL DEFAULT '0', "obj_obj" text NOT NULL DEFAULT '', "obj_channel" bigint NOT NULL DEFAULT '0', + "obj_term" char(255) NOT NULL DEFAULT '', + "obj_url" char(255) NOT NULL DEFAULT '', + "obj_imgurl" char(255) NOT NULL DEFAULT '', + "obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "allow_cid" text NOT NULL, "allow_gid" text NOT NULL, "deny_cid" text NOT NULL, @@ -732,6 +860,11 @@ create index "obj_page" on obj ("obj_page"); create index "obj_type" on obj ("obj_type"); create index "obj_channel" on obj ("obj_channel"); create index "obj_obj" on obj ("obj_obj"); +create index "obj_term" on obj ("obj_term"); +create index "obj_url" on obj ("obj_url"); +create index "obj_imgurl" on obj ("obj_imgurl"); +create index "obj_created" on obj ("obj_created"); +create index "obj_edited" on obj ("obj_edited"); CREATE TABLE "outq" ( "outq_hash" text NOT NULL, @@ -785,6 +918,11 @@ CREATE TABLE "photo" ( "data" bytea NOT NULL, "scale" numeric(3) NOT NULL, "profile" numeric(1) NOT NULL DEFAULT '0', + "photo_usage" smallint(6) NOT NULL DEFAULT '0', + "is_nsfw" smallint NOT NULL DEFAULT '0', + "os_storage" smallint NOT NULL DEFAULT '0', + "os_path" mediumtext NOT NULL, + "display_path" mediumtext NOT NULL, "photo_flags" bigint NOT NULL DEFAULT '0', "allow_cid" text NOT NULL, "allow_gid" text NOT NULL, @@ -802,6 +940,9 @@ create index "photo_aid" on photo ("aid"); create index "photo_xchan" on photo ("xchan"); create index "photo_size" on photo ("size"); create index "photo_resource_id" on photo ("resource_id"); +create index "photo_usage" on photo ("photo_usage"); +create index "photo_is_nsfw" on photo ("is_nsfw"); +create index "photo_os_storage" on photo ("os_storage"); CREATE TABLE "poll" ( "poll_id" serial NOT NULL, @@ -983,6 +1124,7 @@ CREATE TABLE "site" ( "site_realm" text NOT NULL DEFAULT '', "site_valid" smallint NOT NULL DEFAULT '0', "site_dead" smallint NOT NULL DEFAULT '0', + "site_type" smallint NOT NULL DEFAULT '0', "site_project" text NOT NULL DEFAULT '', PRIMARY KEY ("site_url") ); @@ -995,6 +1137,7 @@ create index "site_sellpage" on site ("site_sellpage"); create index "site_realm" on site ("site_realm"); create index "site_valid" on site ("site_valid"); create index "site_dead" on site ("site_dead"); +create index "site_type" on site ("site_type"); create index "site_project" on site ("site_project"); CREATE TABLE "source" ( @@ -1126,6 +1269,13 @@ CREATE TABLE "xchan" ( "xchan_flags" bigint NOT NULL DEFAULT '0', "xchan_photo_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', "xchan_name_date" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + "xchan_hidden" smallint NOT NULL DEFAULT '0', + "xchan_orphan" smallint NOT NULL DEFAULT '0', + "xchan_censored" smallint NOT NULL DEFAULT '0', + "xchan_selfcensored" smallint NOT NULL DEFAULT '0', + "xchan_system" smallint NOT NULL DEFAULT '0', + "xchan_pubforum" smallint NOT NULL DEFAULT '0', + "xchan_deleted" smallint NOT NULL DEFAULT '0', PRIMARY KEY ("xchan_hash") ); create index "xchan_guid" on xchan ("xchan_guid"); @@ -1137,6 +1287,14 @@ create index "xchan_flags" on xchan ("xchan_flags"); create index "xchan_connurl" on xchan ("xchan_connurl"); create index "xchan_instance_url" on xchan ("xchan_instance_url"); create index "xchan_follow" on xchan ("xchan_follow"); +create index "xchan_hidden" on xchan ("xchan_hidden"); +create index "xchan_orphan" on xchan ("xchan_orphan"); +create index "xchan_censored" on xchan ("xchan_censored"); +create index "xchan_selfcensored" on xchan ("xchan_selfcensored"); +create index "xchan_system" on xchan ("xchan_system"); +create index "xchan_pubforum" on xchan ("xchan_pubforum"); +create index "xchan_deleted" on xchan ("xchan_deleted"); + CREATE TABLE "xchat" ( "xchat_id" serial NOT NULL, "xchat_url" text NOT NULL DEFAULT '', diff --git a/install/update.php b/install/update.php index 0e287f20e..10ae6725e 100644 --- a/install/update.php +++ b/install/update.php @@ -1669,7 +1669,22 @@ function update_r1143() { } function update_r1144() { - // hubzilla update does not apply here, but we're keeping the numbers in sync + $r = q("select flags, id from attach where flags != 0"); + if($r) { + foreach($r as $rr) { + if($rr['flags'] & 1) { + q("update attach set is_dir = 1 where id = %d", + intval($rr['id']) + ); + } + if($rr['flags'] & 2) { + q("update attach set os_storage = 1 where id = %d", + intval($rr['id']) + ); + } + } + } + return UPDATE_SUCCESS; } @@ -1725,16 +1740,51 @@ function update_r1148() { } function update_r1149() { + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '', + ADD obj_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + ADD obj_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + } - // hubzilla update does not apply here, but we're keeping the numbers in sync - return UPDATE_SUCCESS; + $r2 = q("create index obj_term on obj ( obj_term ) "); + $r3 = q("create index obj_url on obj ( obj_url ) "); + $r4 = q("create index obj_imgurl on obj ( obj_imgurl ) "); + $r5 = q("create index obj_created on obj ( obj_created ) "); + $r6 = q("create index obj_edited on obj ( obj_edited ) "); + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; } function update_r1150() { - // hubzilla update does not apply here, but we're keeping the numbers in sync - return UPDATE_SUCCESS; + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r1 = q("ALTER TABLE app ADD app_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + ADD app_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' "); + } + else { + $r1 = q("ALTER TABLE app ADD app_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + ADD app_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' "); + } + + $r2 = q("create index app_created on app ( app_created ) "); + $r3 = q("create index app_edited on app ( app_edited ) "); + + $r = $r1 && $r2 && $r3; + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; } @@ -1756,23 +1806,105 @@ function update_r1151() { } function update_r1152() { - return UPDATE_SUCCESS; + + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + + $r1 = q("CREATE TABLE IF NOT EXISTS \"dreport\" ( + \"dreport_id\" int(11) NOT NULL, + \"dreport_channel\" int(11) NOT NULL DEFAULT '0', + \"dreport_mid\" char(255) NOT NULL DEFAULT '', + \"dreport_site\" char(255) NOT NULL DEFAULT '', + \"dreport_recip\" char(255) NOT NULL DEFAULT '', + \"dreport_result\" char(255) NOT NULL DEFAULT '', + \"dreport_time\" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00', + \"dreport_xchan\" char(255) NOT NULL DEFAULT '', + PRIMARY KEY (\"dreport_id\") "); + + $r2 = q("create index \"dreport_mid\" on dreport (\"dreport_mid\") "); + $r3 = q("create index \"dreport_site\" on dreport (\"dreport_site\") "); + $r4 = q("create index \"dreport_time\" on dreport (\"dreport_time\") "); + $r5 = q("create index \"dreport_xchan\" on dreport (\"dreport_xchan\") "); + $r6 = q("create index \"dreport_channel\" on dreport (\"dreport_channel\") "); + + $r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6; + + } + else { + $r = q("CREATE TABLE IF NOT EXISTS `dreport` ( + `dreport_id` int(11) NOT NULL AUTO_INCREMENT, + `dreport_channel` int(11) NOT NULL DEFAULT '0', + `dreport_mid` char(255) NOT NULL DEFAULT '', + `dreport_site` char(255) NOT NULL DEFAULT '', + `dreport_recip` char(255) NOT NULL DEFAULT '', + `dreport_result` char(255) NOT NULL DEFAULT '', + `dreport_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `dreport_xchan` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`dreport_id`), + KEY `dreport_mid` (`dreport_mid`), + KEY `dreport_site` (`dreport_site`), + KEY `dreport_time` (`dreport_time`), + KEY `dreport_xchan` (`dreport_xchan`), + KEY `dreport_channel` (`dreport_channel`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + } + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + } function update_r1153() { - return UPDATE_SUCCESS; + + $r1 = q("ALTER TABLE dreport ADD dreport_queue CHAR( 255 ) NOT NULL DEFAULT '' "); + $r2 = q("create index dreport_queue on dreport ( dreport_queue) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + + } function update_r1154() { - return UPDATE_SUCCESS; + + $r = q("ALTER TABLE event ADD event_vdata text NOT NULL "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + } + function update_r1155() { - return UPDATE_SUCCESS; + + $r1 = q("alter table site add site_type smallint not null default '0' "); + $r2 = q("create index site_type on site ( site_type ) "); + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; } + function update_r1156() { - return UPDATE_SUCCESS; + $r1 = q("ALTER TABLE mail ADD conv_guid CHAR( 255 ) NOT NULL DEFAULT '' "); + $r2 = q("create index conv_guid on mail ( conv_guid ) "); + + $r3 = q("select mail.id, mail.convid, conv.guid from mail left join conv on mail.convid = conv.id where true"); + if($r3) { + foreach($r3 as $rr) { + if($rr['convid']) { + q("update mail set conv_guid = '%s' where id = %d", + dbesc($rr['guid']), + intval($rr['id']) + ); + } + } + } + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; } function update_r1157() { @@ -1784,11 +1916,37 @@ function update_r1157() { } + function update_r1158() { + $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' "); + if($r) { + foreach($r as $rr) { + $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false); + q("update attach set data = '%s' where id = %d", + dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])), + dbesc($rr['id']) + ); + } + } return UPDATE_SUCCESS; } + function update_r1159() { + $r = q("select attach.id, attach.data, attach.hash, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 "); + if($r) { + foreach($r as $rr) { + $x = dbunescbin($rr['data']); + $has_slash = (($x === 'store/' . $rr['channel_address'] . '/') ? true : false); + if(($x === 'store/' . $rr['channel_address']) || ($has_slash)) { + q("update attach set data = '%s' where id = %d", + dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['hash'])), + dbesc($rr['id']) + ); + } + } + } return UPDATE_SUCCESS; } + |