Gorilla.php
changeset 5 7977508aeda3
parent 4 58780df3147b
equal deleted inserted replaced
4:58780df3147b 5:7977508aeda3
    20 define('PASTE_PRIVATE', 1);
    20 define('PASTE_PRIVATE', 1);
    21 
    21 
    22 function gorilla_setupcore(&$paths, &$session)
    22 function gorilla_setupcore(&$paths, &$session)
    23 {
    23 {
    24   // register our paste namespace
    24   // register our paste namespace
    25   $nssep = substr($paths->nslist['Special'], -1);
    25   $paths->create_namespace('Paste', 'Paste:');
    26   $paths->create_namespace('Paste', 'Paste' . $nssep);
       
    27   
    26   
    28   // create our ACLs
    27   // create our ACLs
    29   /**
    28   /**
    30    * @param string $acl_type An identifier for this field
    29    * @param string $acl_type An identifier for this field
    31    * @param int $default_perm Whether permission should be granted or not if it's not specified in the ACLs.
    30    * @param int $default_perm Whether permission should be granted or not if it's not specified in the ACLs.
   784         'namespace' => 'Paste'
   783         'namespace' => 'Paste'
   785       ),
   784       ),
   786     'additionalwhere' => 'AND (paste_flags & ' . PASTE_PRIVATE . ') = 0',
   785     'additionalwhere' => 'AND (paste_flags & ' . PASTE_PRIVATE . ') = 0',
   787   ));
   786   ));
   788 }
   787 }
       
   788 
       
   789 /**!install dbms="pgsql"; **
       
   790 CREATE TABLE pastes (
       
   791     paste_id integer NOT NULL,
       
   792     paste_title text,
       
   793     paste_text text DEFAULT ''::text NOT NULL,
       
   794     paste_author integer DEFAULT 1 NOT NULL,
       
   795     paste_author_name character varying(255) DEFAULT 'Anonymous'::character varying NOT NULL,
       
   796     paste_author_ip character varying(39) NOT NULL,
       
   797     paste_language character varying(32) DEFAULT 'plaintext'::character varying NOT NULL,
       
   798     paste_timestamp integer DEFAULT 0 NOT NULL,
       
   799     paste_ttl integer DEFAULT 86400 NOT NULL,
       
   800     paste_flags integer DEFAULT 0 NOT NULL,
       
   801     paste_parent integer DEFAULT 0 NOT NULL
       
   802 );
       
   803 CREATE SEQUENCE pastes_paste_id_seq
       
   804     START WITH 1
       
   805     INCREMENT BY 1
       
   806     NO MAXVALUE
       
   807     NO MINVALUE
       
   808     CACHE 1;
       
   809 ALTER SEQUENCE pastes_paste_id_seq OWNED BY pastes.paste_id;
       
   810 ALTER TABLE pastes ALTER COLUMN paste_id SET DEFAULT nextval('pastes_paste_id_seq'::regclass);
       
   811 ALTER TABLE ONLY pastes ADD CONSTRAINT pastes_pkey PRIMARY KEY (paste_id);
       
   812 **!*/
   789 
   813 
   790 /**!install dbms="mysql"; **
   814 /**!install dbms="mysql"; **
   791 CREATE TABLE {{TABLE_PREFIX}}pastes(
   815 CREATE TABLE {{TABLE_PREFIX}}pastes(
   792   paste_id int(18) NOT NULL auto_increment,
   816   paste_id int(18) NOT NULL auto_increment,
   793   paste_title text DEFAULT NULL,
   817   paste_title text DEFAULT NULL,