Jump to content

hellomoto

Members
  • Posts

    355
  • Joined

Posts posted by hellomoto

  1. I just realized and then this was already in the Google SERP open from searching "wire in wire function processwire" regarding something else (wire('config') in a function was not a function because the namespace wasn't present):

    wire() in the init method of a module which extends ProcessPageAdd in a different PW instance that is instantiated in ready.php is initialized also in the instance instantiating the other instance. For example:

     
    wire()->addHookBefore("ProcessPageAdd::execute", $this, 'hookPageAdd');

    resulted in an error adding a page of the same template name in the instance instantiating the other one. Prepending with $this-> disables the cross-site functionality.

  2. Maybe it's Firefox looking for favicon file automatically... It goes away if I indicate a favicon... Indicating a nonexistent one changes the stack trace to

    load resource:///modules/FaviconLoader.jsm:180:20
    load resource:///modules/FaviconLoader.jsm:567:70
    loadIcons resource:///modules/FaviconLoader.jsm:645:26
    FaviconLoader/this.iconTask< resource:///modules/FaviconLoader.jsm:621:18
    _runTask resource://gre/modules/DeferredTask.sys.mjs:347:18
    _timerCallback/< resource://gre/modules/DeferredTask.sys.mjs:318:20
    _timerCallback resource://gre/modules/DeferredTask.sys.mjs:337:9
    _startTimer/callback/< resource://gre/modules/DeferredTask.sys.mjs:185:18
    

    Sorry this isn't quite insightful

  3. I don't have a request in templates for favicon.ico.

    In Firefox inspector:

    Request cookies are: 'adminer_key', 'adminer_sid', 'tracy-session', 'wire0s', 'wire1s', 'wire1s_challenge', 'wires', 'wires_challenge'.

    Stack trace:

    load	resource:///modules/FaviconLoader.jsm:180:20
    load	resource:///modules/FaviconLoader.jsm:567:70
    loadIcons	resource:///modules/FaviconLoader.jsm:645:26
    onPageShow	resource:///modules/FaviconLoader.jsm:679:12
    onHeadParsed	resource:///actors/LinkHandlerChild.sys.mjs:56:24
    handleEvent	resource:///actors/LinkHandlerChild.sys.mjs:172:21
    

    I don't know what those are. I did recently install and then afterward notice an odd commit and deleted the module -- https://github.com/FriendsOfProcessWire/FieldtypeLeafletMapMarker/commit/e57e9373e6cccb79fe89dfda00fec117624649f2

    has a bunch of empty files? "Remove executable bit from files"? -- Sorry I just realized the permissions changed from 755 to 644...

     

  4. When I include index.php and run the script via command line `php bootstrap.php` this error is returned:

    PHP Warning:  Cannot modify header information - headers already sent by (output started at /pw/bootstrap/index.php:5) in /pw/index.php on line 41
    404 page not found (no site configuration or install.php available)

    I've tried moving the script around also and it's the same if external...

    <?php namespace ProcessWire;
    
    if (!class_exists('ProcessWire\Templates')) {
        // $pw_dir = dirname(dirname(__FILE__), 2); echo $pw_dir;
        $boot = "../pw/index.php";
        $boot = realpath($boot); echo $boot;
        require_once $boot;// $pw_dir.'/index.php';
        echo 'booted'; exit;
    }

    (so as to not include if ran from within PW instance, also tried with no condition)

  5. Thank you, I tried removing the method & without DatabaseQuerySelectFulltext, but when searching for field='' no results are returned (nor if searching by subfield). Is there no way to reorder the where to be included after the leftjoin when returning this:

    $query->leftjoin("$table AS $_table ON $_table.pages_id=pages.id")->where("$_table.pages_id IS NULL");
    return $query;

    ? The where clause precedes the left join in the join clause before it that includes it?

    ...
    JOIN field_list AS field_list ON field_list.pages_id=pages.id AND ((((field_list_li1.pages_id IS NULL) ) )) 
    LEFT JOIN field_list AS field_list_li1 ON pages.id=field_list_li1.pages_id AND (field_list_li1.pages_id IS NULL) 
    WHERE ...

     

  6. This returns all values (don't know how as I thought I'd tried it already and been getting nothing but errors):

    if ($subfield === 'data' && $value === '' && $operator === '=') {
    	// return pages with no data?
    	static $n = 0;
    	$_table = $table . '_li' . (++$n);
    	$query->leftjoin("$table AS $_table ON pages.id=$_table.pages_id AND ($_table.pages_id IS NULL)");
    	return $query;
    }

    so no error... but ineffective...

    If I insert

    
    			$ft = new DatabaseQuerySelectFulltext($query);
    			$ft->match($table, 'pages_id', $operator, 'NULL');

    first within the above condition, there are no results, and getQuery returns

    SELECT   
    LEFT JOIN field_list AS field_list_li1 ON pages.id=field_list_li1.pages_id AND (field_list_li1.pages_id IS NULL) 
    WHERE field_list.pages_id=:pf21s0X

    so the would-be where gets appended (I tried with value='IS NULL' also?), but what is the code that it outputs? :pf21s0X?

  7. Also tried (from fields in core):

    			static $n = 0;
    			$_table = $table . '_li' . (++$n);
    			$query->leftjoin("$table AS $_table ON $_table.pages_id=pages.id");
    			$query->where("($_table.pages_id IS NULL)");
    			return $query;

    Error:

    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_list_li1.pages_id' in 'on clause'

    Whole query:

    SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id  
    FROM `pages`  
    JOIN field_list AS field_list ON field_list.pages_id=pages.id AND ((((field_list_li1.pages_id IS NULL) ) )) 
    LEFT JOIN field_list AS field_list_li1 ON pages.id=field_list_li1.pages_id AND (field_list_li1.pages_id IS NULL) 
    WHERE (pages.templates_id=124) 
    AND (pages.status<1024)
    GROUP BY pages.id  
    ORDER BY pages.created DESC
    LIMIT 0,25  -- [0.8ms] FAIL SQLSTATE[42S22]

    So on line 3 before the AS comes in the AS pops up...

    With $_table = $table:

    SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'field_list'

    getQuery():

    SELECT   
    LEFT JOIN field_list AS field_list_li1 ON pages.id=field_list_li1.pages_id 
    WHERE (field_list_li1.pages_id IS NULL)

     

  8. Thank you much. Here is the schema:

    
    	public function getDatabaseSchema(Field $field) {
    		$schema = parent::getDatabaseSchema($field); 
    		$schema['data'] = "VARCHAR(21) DEFAULT ''"; // empty placeholder, required
    		$schema['sf1'] = "CHAR";
    		$schema['sf2'] = "INT UNSIGNED";
    
    		return $schema;
    	}

    I added this now to getMatchQuery:

    
    		if ($subfield == 'data' && empty($value) && $operator == '=') {
    			// return pages with no data?
    			$query->leftjoin($table)->where("IS NULL {$table}.pages_id");
    			return $query;
    		}

    but in Lister get this error:

    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL field_list.pages_id ) )) LEFT JOIN field_list WH' at line 3

    It looks as though this is the SQL query:

    SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id  
    FROM `pages`  
    JOIN field_list AS field_list ON field_list.pages_id=pages.id AND (((IS NULL field_list.pages_id ) )) 
    LEFT JOIN field_list 
    WHERE ((pages.parent_id!=2 AND pages.parent_id NOT IN (SELECT pages_id FROM pages_parents WHERE parents_id=2 OR pages_id=2))) 
    AND (pages.status<8192)
    GROUP BY pages.id  
    ORDER BY pages.modified DESC
    LIMIT 0,25  -- [0.2ms] FAIL SQLSTATE[42000]

    Thanks @ryan

  9. public function getMatchQuery($query, $table, $subfield, $operator, $value) {
          if (!$subfield) $subfield = 'data';
    
          // search for empty/not empty:
          if ($subfield == 'data' && empty($value) && $operator == '!=') {
              // doesn't work for '=', same result
              $ft = new DatabaseQuerySelectFulltext($query);
              $ft->match($table, 'sf1', $operator, $value)->match($table, 'sf2', $operator, $value);
              return $query;
          }
          if ($subfield == 'data' && empty($value) && $operator == '=') {
              // return pages with no data?
          }
    }

    Presently it returns all pages where field in question is populated, whether searching for empty or not empty.

    When field value is empty, there is no row representing it in the field table. How can I return those pages when searching `fieldname=''` if the page template has the field?

    EDIT: I replied to this myself with details of issues I encountered trying to resolve it but essentially I can't figure out how to have the "where" method added to the query added ultimately AFTER the left join. The left join is aliased (or error that it isn't unique), but the where statement included with/after it always is included in the whole statement in the JOIN preceding the LEFT JOIN where the alias is introduced.

        static $n = 0;
        $_table = $table . '_li' . (++$n);
    
        $ft = new DatabaseQuerySelectFulltext($query);
        $query->leftjoin("$table AS $_table ON $_table.pages_id=pages.id")->where("$_table.pages_id IS NULL");
    
        return $query;

    Resulting Lister query:

    SELECT SQL_CALC_FOUND_ROWS pages.id,pages.parent_id,pages.templates_id  
    FROM `pages`  
    JOIN field_list AS field_list ON field_list.pages_id=pages.id 
    AND (((field_list_li1.pages_id IS NULL ) )) 
    LEFT JOIN field_list AS field_list_li1 ON field_list_li1.pages_id=pages.id 
    WHERE (pages.templates_id=124) 
    AND (pages.status<1024)
    GROUP BY pages.id  
    ORDER BY pages.created DESC;

    so if that would-be WHERE AND clause preceding the LEFT JOIN would just come after it instead, it should work, but how?

  10. Are URL segments indexable & search engine optimizable? Site-mappable? With or without SEO meta tags rendered in the native site template rendering the URL segment, drawing page data from a separate PW installation? if only rendering when the urlSegment1 matches the name of a page of a specified template with the same parent? I don't know how to test this locally. Thank you.

  11. Disabling textformatters: FieldtypeSomething > init() >

    parent::allowTextFormatters(false);

    Making the pattern readonly: InputfieldSomething > ___getConfigInputfields() >

    $f = $inputfields->get('pattern');
    if($f) $f->attr('disabled', 'disabled');

    To alter the pattern without reinstalling the Fieldtype, it isn't stored in the database? I can do it via API, but where is it stored? It's missing from the data column of the fields table for the field where all the other attributes are.

  12. DEVELOPMENT mode had to be enforced. But changing from DETECT to DEVELOPMENT and also checking "Restrict superusers" results in its disappearance again... Those options seem somewhat redundant, but the latter is to exclude any other roles granted the "tracy-debugger" permission from its use, however it doesn't seem to work. I tried with the permission created and unassigned, assigned, and deleted. Am I misunderstanding it?

    I reverted to DETECT and checked "Force superusers into DEVELOPMENT mode".

×
×
  • Create New...